How to return to terminal when logstash filter get eof?

后端 未结 2 515
忘掉有多难
忘掉有多难 2021-01-27 08:02

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 l

相关标签:
2条回答
  • 2021-01-27 08:46

    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?

    0 讨论(0)
  • 2021-01-27 08:53

    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.

    0 讨论(0)
提交回复
热议问题