【发布时间】:2019-11-20 07:45:30
【问题描述】:
我正在尝试在管道输出配置的上下文中使用 Logstash 条件。
基于负载中 device 字段的存在,我想将事件转发到 Elasticsearch 中的适当索引名称:
output {
elasticsearch {
hosts => ["10.1.1.5:9200"]
if [device] ~= \.* {
index => "%{[device][0]}-%{+YYYY.ww}"
} else {
index => "%{[beat][name]}-%{+YYYY.ww}"
}
}
}
上述代码将失败,日志中显示以下 mgs 指示语法错误:
...
"Expected one of #, => at line 14, column 12 (byte 326) after output {\n elasticsearch {\n hosts => [\"10.1.1.5:9200\"]\n if "
...
有人可以建议吗?
【问题讨论】:
标签: elasticsearch logstash filebeat