How to return to terminal when logstash filter get eof?

吃可爱长大的小学妹 提交于 2019-12-02 16:29:43

问题


Now when logstash filter get eof, it seems that logstash filter is running yet, but file doesn't have more logs to output to elasticsearch index.

How can i get out of logstash filter when it's the end of file (eof), to do another tasks?


回答1:


I solve the problem using exec on output of logstash filter, and create a bash script to kill logstash process.

In logstash filter:

   input
   {
      ...
   }
   filter
   {
      ...
   }
   output
   {
     exec
    {
        command => "sh kill_logstash.sh"
    }
     ...
   }

In bash script (kill_logstash.sh):

   #!/bin/bash
   echo 'Terminou a leitura do ficheiro'
   pkill -f  logstash
   exit 0

Same Problem: How to automatically kill a logstash agent when tests are done?




回答2:


there is no concept of eof in logstash. logstash continuous monitor input file . if any change happen in file it will send to filter . if you want to monitor multiple file than you can give multiple files block in input section.



来源:https://stackoverflow.com/questions/31552053/how-to-return-to-terminal-when-logstash-filter-get-eof

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!