Logstash: How to stop logstash once the scheduled job is complete

Hi,

I have cron scheduled jobs, which would append the data into Elasticsearch indexes. The scheduled job is supposed to run on daily basis. I have different set of files to load. So I need to know, how we can stop the Logstash automatically once the job is complete and start picking the next files to load into ES.

Anyone has any idea on this?

Logstash is not designed to work this way. It expects to keep running forever waiting for additional lines to be appended to a file, or for new files to appear. You would have to do something external to logstash to kill the cron job when you can see all of the data has been loaded to elasticsearch.

One exception would be if you can use a stdin input, which will terminate logstash when it reaches EOF.

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