如何为Kibana中显示的以下示例日志消息定义grok过滤模式?我已经定义了更多的模式,但得到了_grokparsefailure
2018-12-10 14:50:01,497 [traceID : 46072cedb98568e3 spanID: 46072cedb98568e3 parent: ] service : networkService [XNIO-2 task-1] org.mongodb.driver.connection - Opened connection [connectionId{localValue:2, serverValue:3209}] to 192.168.0.207:27017这是我(WGSSAMINTHA)尝试的解决方案。
filter {
grok {
match => {
"message" => "%{IP:client} %{WORD:method} %{WORD:service}
%{URIPATHPARAM:request} %{NUMBER:duration}"
}
remove_field => [ "_type:doc",
"_index:archisoft-log-all",
"_score: dev" ]
}
} 发布于 2018-12-10 23:59:25
此grok模式"%{IP:client} %{WORD:method} %{WORD:service} %{URIPATHPARAM:request} %{NUMBER:duration}"解析所提供的日志行是错误的。grok模式将被转换为正则表达式,日志行将根据该正则表达式进行匹配;如果正则表达式与日志行不匹配,则会得到_grokparsefailure。这意味着基本模式的顺序很重要。
由于您没有说明您希望从日志行获得哪些信息,因此我提取了一些看起来很重要的部分:
grok {
match => {
"message" => "^%{TIMESTAMP_ISO8601:date} \[traceID \: %{DATA:traceID} spanID\: %{DATA:spanID} parent\: %{DATA:parent}\] service \: %{WORD:service} \[%{DATA:thread}\] %{DATA:message}$"
}
}这将提取这些值:
parent
spanID 46072cedb98568e3
service networkService
thread XNIO-2·task-1
date 2018-12-10·14:50:01,497
message org.mongodb.driver.connection - Opened connection [connectionId{localValue:2, serverValue:3209}] to 192.168.0.207:27017
traceID 46072cedb98568e3 https://stackoverflow.com/questions/53700810
复制相似问题