Logstash when launched as service keeps restarting

Viewed 2002

So I had the exact same issue as described in https://discuss.elastic.co/t/consistent-restarts-of-logstash-with-high-cpu-recorded/86597:

I'm running Logstash as a service on Ubuntu. And I'm launching it by

sudo systemctl start logstash.service

My task was simple: import data from jdbc (MySQL) into Elasticsearch in a one shot manner (so no scheduling option. no cron timer). So as in the link above, I'm using a JDBC input filter. And the elasticsearch output filter.

I managed to get it to work well when I launched logstash directly through command line (logstash -f conf_file): logstash starts, imports the data and shutdown. Just as expected.

Now, when I tried to do the same when I was launching logstash as a service, it would keep importing the data and restarting over and over again.

The link above provide a solution but it's actually wrong. It says that when no "schedule" option is specified, a default 1 minute timer is used. This is in direct contradiction with what the documentation says here:

There is no schedule by default. If no schedule is given, then the statement is run exactly once.

2 Answers

There is another case: logstash keeps restarting when the logstash conf file is not written correctly, so if you have this issue, first check if the syntaxe is correct

Related