Logstash .conf file run forever as a service?

i want to run logstash.conf file forever in server . Everytime i have to run this command

sudo /usr/share/logstash/bin/logstash -f /etc/logstash/conf.d/logstash.conf

but i want run some command which will run forever. I got this command but its not working

nohup /usr/share/logstash/bin/logstash -f /etc/logstash/conf.d/logstash.conf > /dev/null &

is there any thing wrong ?

Hi @inandi,

on which operating system is your Logstash service running? And how is Logstash installed?

hi @A_B,

it is Ubuntu Server 18.10 and i have followed this commands

  1. sudo apt-get update
  2. sudo apt-get install logstash
  3. sudo systemctl restart logstash

Then sudo systemctl start logstash will start Logstash as a service (in background = run forever) using default config file which should be /etc/logstash/conf.d/logstash.conf.

1 Like

what if i have multiple conf file ?

That is another question... Do you really need more than one?

I guess you can create several SystemD unit files that use different config files. That is what I used to do for Elasticsearch.

So far I have been able to get by with just one Logstash config. It is getting a bit long with close to 20 different inputs and plenty of conditionals in the filter section.

Then there are Logstash pipelines that might help you.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.