Search code examples
dockerelasticsearchlogstashelastic-stack

How to close the docker container after logstash pipelines worked?


I have two pipelines in my Logstash docker container. First pipeline runs mysql database query and writes it to elasticsearch. And other writes logs from log file to elasticsearch.

I want to close the docker container after the processes are finished. How can I do this?


Solution

  • I did a little hack by running exec script in the ouput of the Logstash conf file, which will get the total count of records in Elasticsearch, when it is expected, kill the Logstash process and the container will be stopped.