I am really struggling to launch logstash as a service on CentOS 7 (see confused and concerned topic below). Since I cannot figure out what or where to set the
-DJava.io.tmpdir= variable (which apparently would solve my issue), I am trying to create a little script to launch the logstash command line on boot.
The following line works manually for me:
sudo /usr/share/logstash/bin/logstash -f /etc/logstash/conf.d
That successfully loads and opens port 5000.
So I am trying to create a boot time script to run that line and start logstash.
My problem is that I think I need the sudo command as it fails to run without it. Does anyone know how I can get this to work?
I have the following files /etc/systemd/system/mylogstash.service:
and also /usr/local/bin/mylogstashstart.sh:
/usr/share/logstash/bin/logstash -f /etc/logstash/conf.d
To make the script executable I have done:
chmod 744 /usr/local/bin/mylogstash.sh
chmod 664 /etc/systemd/system/mylogstash.service
It fails to execute as there are insufficient permissions. How do I replicate the Sudo in the script without storing a password and do I even need to?
Can anyone tell me where I have gone wrong please? I'm getting pretty desperate, and no-one likes to see a man desperate...