我想从filebeat提供的源值中获取文件名。
output {
if [type] == "wxnumber" {
elasticsearch {
hosts => "localhost:9200"
sniffing => false
manage_template => false
index => "%{[source]}"
document_type => "%{[@metadata][type]}"
}
}
}
%{[source]}
通常类似于/aaa/bbb/ccc.log
。如何将索引设置为ccc.log
?
最佳答案
也许您可以使用mutate
来替换为您的日志文件命名方式:
if [%{[source]}] =~ /aaa/bbb/ccc.log {
mutate {
replace => ["%{[source]}]", "ccc.log"]
}
}
这个SO可能会有所帮助!
关于elasticsearch - 如何从Logstash中filebeat提供的源值中获取文件名?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41015195/