简体   繁体   中英

Logstash grok filter, debugger OK but failure in logstash parsing

my grok filter is ok in grok Debugger but not work when i start logstash.

my line log

[Mon Aug 28 09:16:16.028821 2017] [php7:notice] [pid 11111] [client 22.22.66.66:66666] message d'erreur

my .conf

filter { 
   grok { 
      match => { "message" => "\[%{DAY:day} %{MONTH:month} %{MONTHDAY:monthday} %{TIME:time} %{YEAR:year}\] \[%{WORD:php}:%{WORD:logelvel}\] \[%{WORD} %{WORD:processus}\] \[%{WORD} %{IP}:%{POSINT:port}\] %{GREEDYDATA: message}" }
   } 
}

Result :

@timestamp:August 28th 2017, 10:40:22.380 offset:5,269 @version:1 input_type:log beat.hostname:ip-166-55-55-55 beat.name:ip-166-55-55-55 beat.version:5.5.1 host:ip-175-61-66-66 source:/var/log/apache2/filelog.log 
message:[Mon Aug 28 09:10:59.023093 2017] [php7:notice] [pid 11111] [client 22.22.66.66:66666] 
message d'erreur type:log tags:beats_input_codec_plain_applied, _grokparsefailure _id:AV4n_8akHhd-RttynnUH _type:log _index:index-2017.08.28 _score: -

Thank your very much for your help.

您需要像这样转义方括号:

\[%{DAY:day} %{MONTH:month} %{MONTHDAY:monthday} %{TIME:time} %{YEAR:year}\] \[%{WORD:php}:%{WORD:logelvel}\] \[%{WORD} %{WORD:processus}\] \[%{WORD} %{IP}:%{POSINT:port}\] %{GREEDYDATA:message}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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