问题
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