我只想在日志路径包含特定关键字的文件上运行管道,如何在管道中执行此操作?
管道(删除了我的模式,因为它不相关(:
{
"description" : "...",
"processors": [
{
"grok": {
"if": "ctx['log']['file']['path'].value.contains('keyword')",
"field": "message",
}
}
]
}
在Kibana中,我看到我有log.file.path作为元数据,如果它包含关键字,我只想运行管道,但由于我的if语句,我遇到了运行时错误。
谢谢你的帮助!
编辑:我认为问题在于我如何访问log.file.path字段,因为我不知道如何从这里正确引用它。
您可能可以使用Drop处理器https://www.elastic.co/guide/en/elasticsearch/reference/current/drop-processor.html
"drop": {
"if": "ctx.log.file.path.contains('keyword');"
}
你可以在这里找到更复杂的例子:https://www.elastic.co/guide/en/elasticsearch/reference/master/ingest-conditional-complex.html