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

Vya*_*pal 5 elasticsearch logstash logstash-configuration elastic-stack

目前我正在开发一个应用程序,我需要从特定位置的文件中的特定数据创建文档.我已经设置了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"
  }
}
Run Code Online (Sandbox Code Playgroud)

我想在调用API之前在输出中提供IF条件.条件应该是,"如果来自输入的数据包含单词'错误',则只进一步调用提到的http API."

我对如何做同样的想法?

use*_*592 1

请查看此链接:如果日志包含特定单词,则忽略并移至下一个模式

第一步看输入的关键字是否有错误,如果有,则继续第二个grok的解析。如果没有,就忘记输入。