"D:\ELK_Info-6ren">
gpt4 book ai didi

elasticsearch - 如何获取日志及其中包含单词 "error"的数据以及如何为其配置 logstash PipeLine.conf 文件?

转载 作者:行者123 更新时间:2023-11-29 02:50:25 24 4
gpt4 key购买 nike

目前我正在开发一个应用程序,我需要从特定位置的文件中的特定数据创建文档。我已经设置了 logstash 管道配置。

这是目前的样子:

input{
file{
path => "D:\ELK_Info\logstashInput.log"
start_position => "beginning"
}
}
#Possible IF condition here in the filter

output {
#Possible IF condition here
http {
url => "http://localhost:9200/<index_name>/<type_name>"
http_method => "post"
format => "json"
}
}

我想在调用 API 之前在输出中提供 IF 条件。条件应该是这样的,“如果来自输入的数据包含单词‘错误’,那么只有进一步调用提到的 http API。”

关于我如何做同样的事情有什么想法吗?

最佳答案

请查看此链接:Ignore and move to next pattern if log contains a specific word

第一步是看input是否有error作为关键字,如果有则继续second grok解析。如果没有,就忘记输入。

关于elasticsearch - 如何获取日志及其中包含单词 "error"的数据以及如何为其配置 logstash PipeLine.conf 文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51749854/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com