如何在logstash过滤器获取eof时返回到终端? [英] How to return to terminal when logstash filter get eof?
问题描述
我得到的logstash过滤器时,它的文件(EOF)的结束,做另一个任务?解决方案
在logstash过滤器的输出上使用exec,并创建一个bash脚本来杀死logstash进程。
在logstash过滤器中:
输入
{
...
}
过滤
{
...
}
输出
{
exec
{
command => sh kill_logstash.sh
}
...
}
<在bash脚本(kill_logstash.sh)中:
#!/ bin / bash
echo'Terminou a leitura do ficheiro'
pkill -f logstash
exit 0
同样的问题: a href =https://stackoverflow.com/questions/18299337/how-to-automatically-kill-a-logstash-agent-when-tests-are-done>如何在测试完成后自动杀死logstash代理?
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?
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?
这篇关于如何在logstash过滤器获取eof时返回到终端?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!