Unable to read logs from specific folder - filebeat

I need to send log files from a path that has a $ character:
\\h1356.google\c$\Logs\Logs*.log
When I run it using .\filebeat.exe -c filebeat.yml -e -d "*" in PowerShell, it works perfectly. But when I try to run it as a service (clicking Start in the filebeat service) it doesn't send any log to Kafka
I have the same configuration file in +50 servers that don't include any $ and work perfectly everywhere just by starting the service
How can I write the path? I tried:
"\h1356.google\c$\Logs\Logs*.log"
"\\h1356.google\c$\Logs\Logs*.log"
\h1356.google\c"$"\Logs\Logs*.log
and many other combinations

Related

Using mpirun with a provided ssh file

I am trying to run mpi on an external server. As a part of my goal, I'm attempting to run something in parallel across multiple nodes.
However, this external server has a bad default configuration file that is readonly, such that when I try to ssh to another external server without using ssh <server> -F ~/.ssh/config then it will simply return four different "Bad configuration option"s. However, -F is not an option that I can use for mpirun, and I don't know if there is any way to manually change the ssh configuration file for mpirun.
What should I do?

Robot Framework - SSH library - Editing a file on remote server

I am writing a test case in Robot Framework where in, I have to either copy the file from the local machine (windows) to the remote server (linux) or create a new one at the location.
I have used multiple sudo su - command to switch users to root user to reach the desired host. As a result of this, I am not able to use Put File Keyword from SSH Library to upload the file. I have reached at the desired folder location by executing the commands with Write keyword.
Since there is no option left (thats what i realize with my limited knowledge on Robot Framework), i started creating a new file with vi <filename> command. I have also reached the INSERT mode of the file, BUT i am not able to edit text into the file.
Can someone please suggest me how can i either
Copy the file from local windows machine to remote linux server AFTER multiple SU commands (Switch User)
Create a new text file and enter the content.
Please See : the new file which is being created / copied is a certificate file. Hence i do not wish to write the entire content of the certificate in my test suite file
The entire test case looks something like this
First Jump1
Log Starting the connection to AWS VM
# Connection to VM with Public Key
Connection To VM ${hostname} ${username}
Send Command sudo su -
Send Command su - <ServiceUser1>
# Reached the Detination server
Send Command whoami
Send Command ss -tln | grep 127.0.0.1:40
# Connecting to Particular ZIP
Send Command sudo -u <ServiceUser2> /usr/bin/ssh <ServiceUser2>#localhost -p <port>
Send Command sudo su -
# Check Auth Certificate
Send Command mosquitto_pub -h ${mq_host} -p ${mq_port} -u ${mq_username} -P ${mq_password}
In the step Check Auth Certificate, the certificate is checked to be present or not, if present -> delete the current certificate and create the new one (either create a new file or upload from local) and if it not there create a new certificate
though it might not be ideal, but was able to achieve what i wanted to do with
echo "content" > newFilename
echo "update content" >> newFileName

LDAP Unable to start openldap for windows

I watched youtube online as reference to install openldap on windows,
I also followed the tutorial on zytrax.com
C:\OpenLDAP>slaptest -f slapd.conf -F slapd.d
5c9eec00 using config directory slapd.d, error 0
config file testing succeeded
there is this part "Conversion to slapd.d is trivial. After modifying the slapd.conf file as required simply create a new directory/folder called slapd.d. Open a command line (dos box for us oldies), navigate to c:\OpenLDAP (or wherever you put your installation) and enter:" in which I don't understand, what do I need to configure in slapd.conf
C:\OpenLDAP>slapd -d 8 -h "ldaps://localhost/ ldap://localhost/"
5c9ef038 OpenLDAP 2.4.42 Standalone LDAP Server (slapd)daemon: bind(2) failed errno=10013 (WSAEACCES)
5c9ef038 daemon: bind(3) failed errno=10013 (WSAEACCES)
5c9ef038 slapd stopped.
5c9ef038 connections_destroy: nothing to destroy.
How do I get my ldapserver to start running ?
I had the same issue and my issue was that the ports were already open by another service. Try specifying other ports when starting the slapd server.
slapd -d 8 -h "ldaps://localhost:6866/ ldap://localhost:3899/"

Allowing Apache on EC2 to run sudo commands via CGI script

I have an Amazon (AMI) Linux EC2 instance running on AWS. I'm create a perl script that will create directories when it is called through a web url (CGI script).
However, because the browser is executing the script, the user apache is running the perl script. Because apache is not allowed to do mkdir command without using sudo none of the directories are being created.
I've modified the scripts permissions to execute (755) via the browser, however none of the mkdir commands work.
I even tried using the sudo command within the perl script, but I have no luck. However, all of the non sudo commands work such as 'cd' etc.
If anyone knows how to resolve this issue I would appreciate it.
I've found the answer through searching.
The first thing you need to do is disable tty for the current user.. my web browser executes anything as the user 'apache' on the server.
So in my /etc/sudoers file i added
Defaults:apache !requiretty
Also i created a list of commands that I want apache to use without requiring the sudo password
Cmnd_Alias APACHE = /bin/mkdir, /bin/rmdir
apache ALL=(ALL) NOPASSWD: APACHE
This allows only certain sudo commands to execute on my web server without requring the password.
NOTE: only open the /etc/sudoers file using the visudo command... DO NOT open it using just regular vim or nano because if you save it and theres an error it will **** your machine up and you may have to create a whole new server because any sudo commands wont execute.
u can specify your editor using visudo.. e.g
EDITOR=nano visudo

How can I play a wav sound on the server side using cgi?

How can I run a command from a (bash) CGI script to play a wav sound on the server side?
You can execute your command line audio player as described by nak, but this may not work due to the permissions of the user running Apache. By default Apache is run as www-data:www-data (or apache:apache or www:www on some distros). As a quick fix/test you can set Apache to run as a user that has permissions to access the audio device on the machine by modifying your /etc/apache2/apache2.conf (or /etc/httpd/httpd.conf") file to have:
User USER_THAT_CAN_PLAY_AUDIO
Group USER_THAT_CAN_PLAY_AUDIO
Warning: this is not secure and is not intended to be a permanent solution!
This is how I would do it
#!/bin/sh
echo Content-type: text/plain
echo ""
echo "Server is playing sine.wav!"
aplay -q sine.wav
I stumbled over this old question looking how to solve the same problem: to have my personal Apache webserver warning me when someone makes a specific request (in my case a call for chat without the need to have any IM running).
The solution below is what I use on Slackware 14.1: according to your distro YMMV.
launch visudo
add the line TheUserRunningApache ALL=(ALL) NOPASSWD: /usr/bin/play (TheUserRunningApache is the user name used by your Apache)
In the PHP page you want to play a sound add this line: system ("sudo /usr/bin/play SOUND.WAV");
If you don't want to give access to Apache to the /usr/bin folder, even if limited just to play, you can copy the sox executable (the program used to run /usr/bin/play) elsewhere, but you'll have to modify the last two instructions above accordingly.