Search code examples
linuxlogstashamazon-linux

How to install multiple logstash instances on a linux machine?


How do I install multiple instances of logstash on a linux machine? I want 2 different services (each one will have its own config) running at the same time?

(this might be a simple question but just because I'm a noob on linux I couldn't figure it out)


Solution

  • The link that @fylie posted is quite useful but still needed some tweaks.

    Here's my new insights - make a copy of /etc/init.d/logstash and adjust the name variable near the top of the file - I didn't know but just making a copy of this file was enough in linux for a service to be created. If I copied it into a file named "logstash2" I could now run "service logstash2 start" and it worked.

    I've edited the new /etc/init.d/logstash2 and changed the values of LS_CONF_DIR and LS_LOG_DIRto new folders I've created. But it didn't work until I ranchown -R logstash:logstash /var/log/logstash2` on my newly created "logstash2" dir.

    It was also possible to override the LS_CONF_DIR and LS_LOG_DIR etc. by creating a file in /etc/sysconfig with the service name (logstash2) and uncommenting the relevant lines.

    Then to make it run as a startup service I had to run: chkconfig --add logstash2