How can I start automatic Logstash? (SOLVED)


(Killmasta93) #1

Hi,
I was wondering how can I put logstash to start automatic when it boots up I have had no luck on putting it as a daemon maybe as service? Operating system Lubuntu

Every time Lubuntu restarts I have to run the command

service logstash restart

then it starts working logstash to get the logs from pfSense

Thank you


(Magnus Bäck) #2

The Logstash Debian package includes both a SysV init script and an Upstart configuration file. I would've expected Lubuntu to use Upstart in which case it should start Logstash upon system start without you having to do anything. If Lubuntu uses a SysV init you'll have to set up the symlinks to the init script with update-rc.d logstash defaults.


(Killmasta93) #3

Hi,
Thank you for your reply But im somewhat lost :frowning: So in therory Lubuntu should already start logstash. But Not sure why its seems that in my case it does not start.

I did these commands to install logstash

echo 'deb http://packages.elasticsearch.org/logstash/1.4/debianstable main' | sudo tee /etc/apt/sources.list.d/logstash.list

then i installed it

sudo apt-get update && sudo apt-get install logstash=1.4.2-1-2c0f5a1

Did i miss a command to start logstash? Because on start on virtual file system says its on

Thank you


(Killmasta93) #4

Hi,
So I resolved the issue by running these 2 commands

chmod 755 /etc/init.d/logstash

then run

update-rc.d logstash defaults 95 10

and now its working flawless

Thank again


(Magnus Bäck) #5

Did i miss a command to start logstash? Because on start on virtual file system says its on

Yes, but maybe Lubuntu doesn't use Upstart. Ubuntu does but Debian doesn't (by default).

Unless already addressed in Logstash 1.5 I'd say this is a bug, by the way: When the Debian package is installed on an Upstart system Logstash is started upon boot but to get that behavior on plain SysV systems you need to explicitly set up init.d symlinks.

So I resolved the issue by running these 2 commands

chmod 755 /etc/init.d/logstash

Okay, but it wasn't necessary to chmod the file as it already has the right permissions:

$ dpkg-deb -c /var/cache/apt/archives/logstash_1.4.2-1-2c0f5a1_all.deb | grep init.d
drwxrwxr-x 0/0               0 2014-06-24 14:41 ./etc/init.d/
-rwxr-xr-x 0/0            3462 2014-06-24 14:41 ./etc/init.d/logstash
-rwxr-xr-x 0/0            3366 2014-06-24 14:41 ./etc/init.d/logstash-web

(system) #6