简体   繁体   English

Kibana。 从@message中提取包含JSON的字段

[英]Kibana. Extract fields from @message containing a JSON

I would like to extract in Kiabana fields from @message field which contains a json. 我想从包含一个json的@message字段中提取Kiabana字段。 ex: 例如:

Audit{
uuid='xxx-xx-d3sd-fds3-f43',
action='/v1.0/execute/super/method', 
resultCode='SUCCESS', 
browser='null', 
ipAddress='192.168.2.44', 
application='application1', 
timeTaken='167'
} 

Having "action" and "application" fields I hope to be able to find top 5 requests that hits the application. 我希望拥有“操作”和“应用程序”字段,希望能够找到命中该应用程序的前5个请求。

I started with something similar to this: 我从类似于以下内容开始:

filter {
    if ([message]~ = "Audit") {
        grok {
            match => {
                "message" => "%{WORD:uuid}, %{WORD:action}, %{WORD:resultCode}, %{WORD:browser}, %{WORD:ipAddress}, %{WORD:application}, %{NUMBER:timeTaken}"
            }
            add_field => ["action", "%{action}"]
            add_field => ["application", "%{application}"]
        }
    }
}

But it seems to be too far from reality. 但这似乎与现实相去甚远。

If the content of "Audit" is really in json format, you can use the filter plugin "json" 如果“审核”的内容确实是json格式,则可以使用过滤器插件“ json”

json{
    source => "Audit"
}

It will do the parsing for you and creates everything. 它将为您进行解析并创建所有内容。 You don't need grok / add_field. 您不需要grok / add_field。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM