如何解决Logstash不使用值替换“%type”
您好,我在计算机上运行的logstash具有此配置:
input {
exec {
command => "powershell -executionpolicy unrestricted -f scripts/windows/process.ps1 command logstash"
interval => 30
type => "process_data"
codec => line
tags => [ logstash" ]
}
}
output
{
if "sometype-logs" in [tags] {
elasticsearch {
action => "index"
doc_as_upsert => true
index => "sometype-logs-%{+YYYY.MM.dd}"
hosts => "locahost:9200"
template_overwrite => true
}
} else {
elasticsearch {
action => "index"
doc_as_upsert => true
index => "%{type}"
hosts => "localhost:9200"
template_overwrite => true
}
}
显示索引时,我有:
为什么索引名是“%type”而不是“ process_data”?
解决方法
可能只是关于语法的一些东西。要使用数据的某些字段,必须使用此语法
%{[somefield]}
(请参阅本文档page上的示例)
因此,您可以尝试以下方法:
"%{[type]}"
代替
"%{type}"
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。