Running logstash in the background in production environment

Hi,

I think i am having difficulty on starting logstash as a service which runs continuously in the background to read all the config files under the directory /etc/logstash/conf.d/

Although when i run it like /usr/share/logstash/bin/logstash -f /etc/logstash/conf.d/first.conf , it works fine and does what is written in the config file. But in the production environment, the service has to continously run and keep loading the files present in /etc/logstash/confd./

/usr/share/logstash/bin/logstash -f /etc/logstash/conf.d/first.conf &

Or am I misunderstanding your question? Try adding the &

This is fine as long as i am loading first.conf file, but in the real scenario the input would be a beat plugin listening on port 5044, for that logstash service should be continuously running.

How do i make logstash running continously and loads multiple config files that i have in /etc/logstash/conf.d

I think i am having difficulty on starting logstash as a service which runs continuously in the background to read all the config files under the directory /etc/logstash/conf.d/

Thanks Magnus, i did that but right after 4 seconds the process exits and it tries to restart

logstash.service - logstash
Loaded: loaded (/etc/systemd/system/logstash.service; enabled; vendor preset: disabled)
Active: activating (auto-restart) (Result: exit-code) since Mon 2017-08-07 14:30:21 UTC; 18ms ago
Process: 28825 ExecStart=/usr/share/logstash/bin/logstash --path.settings /etc/logstash (code=exited, status=1/FAILURE)
Main PID: 28825 (code=exited, status=1/FAILURE)

Aug 07 14:30:21 ip-10-xx.xx.xx.domain.com systemd[1]: logstash.service: main process exited, code=exited, status=1/FAILURE
Aug 07 14:30:21ip-10-xx.xx.xx.domain.com systemd[1]: Unit logstash.service entered failed state.
Aug 07 14:30:21 ip-10-xx.xx.xx.domain.com systemd[1]: logstash.service failed.

When i run logstash like this

/usr/share/logstash/bin/logstash --path.settings /etc/logstash/conf.d -f /etc/logstash/conf.d/app.conf & it works forever, but not when i run this systemctl start logstash

No errors logged in /var/log/logstash.log

1 Like

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