我有一个 Logstash 代理来监视我们的自动测试的日志转储 -
在每批测试开始时,都会启动一个代理,侦听特定文件夹,并在结束时停止。
问题是在最后 - 我需要以某种方式向 Logstash 代理发出信号,表明测试已完成并杀死自己。
我怎样才能做到这一点?
配置代理的方法是什么,以便当它看到测试中的某个日志消息时它会自杀?
我的配置文件:
input {
file {
type => "cloudify-logs"
path => "<path_to_test_class_folder>/*"
tags => [ "<suite_name>" , "<test_name>" , "<build_number>" , "<version>" ]
}
}
output {
stdout { debug => true debug_format => "json"}
redis { host => "<host>" data_type => "list" key => "logstash" }
}
一种选择是在日志末尾添加一行,例如:
END TEST
然后,您可以创建一个 LogStash“kill”脚本,当 LogStash 到达该行时将执行该脚本。
例如:
filter
{
if [message] =~ "^END TEST"
{
mutate
{
add_tag => ["end"]
}
}
}
output
{
if "end" in [tags]
{
exec
{
command => "kill_logstash.sh"
}
}
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)