简体   繁体   English

如何用logstash修改此输入?

[英]How to grok this input with logstash?

I'm trying to grok some lines with logstash, so first I created two patterns witch look like this : 我试图用logstash绘制一些行,所以首先我创建了两个如下所示的女巫模式:

AZ_LIST [1-9a-zA-Z,]+
AZ_STRING [a-zA-Z._-]+

and then I configured logstash to grok this input : 然后我将logstash配置为使用此输入:

security=0 system=23 CPU=this.adresse_false Pvm=0,0,0,0,0,0,0,0 Vlan2=AZERT,566,2184,798,3312  

My filter is : 我的过滤器是:

filter {
    grok {
        patterns_dir => "/patterns"

        match => [
            "message" , "security=%{NUMBER:security} system=%{NUMBER:system} CPU=%{AZ_STRING:CPU} Pvm=%{AZ_LIST:Pvm} Vlan2=%{AZ_LIST:Vlan2}"
         ]
        tag_on_failure => [ "failure_grok_exemple" ]
        break_on_match => false  
    }
}

But these doesn't work 但是这些不起作用

There is an error in your pattern. 您的模式有错误。 Your AZ_LIST do not include 0 , but your logs have 0 EX: Pvm=0,0,0,0,0,0,0,0 您的AZ_LIST不包含0 ,但是您的日志具有0 EX: Pvm=0,0,0,0,0,0,0,0

This is my config, I can parse your log successfully. 这是我的配置,我可以成功解析您的日志。

filter {
        grok {
                patterns_dir => "./patterns/"
                match => [
                "message" , "security=%{NUMBER:security} system=%{NUMBER:system} CPU=%{AZ_STRING:CPU} Pvm=%{AZ_LIST:Pvm} Vlan2=%{AZ_LIST:Vlan2}"
                ]
        }
}

Pattern: 图案:

AZ_LIST [0-9a-zA-Z,]+
AZ_STRING [a-zA-Z._-]+

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

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