[2014-03-02 17:34:20] - 127.0.0.1|ERROR| E:\xampp\htdocs\test.PHP|123|subject|The error message goes here ; array ( 'create' => array ( 'key1' => 'value1','key2' => 'value2','key3' => 'value3' ),) [2014-03-02 17:34:20] - 127.0.0.1|DEBUG| flush_multi_line
第二个条目[2014-03-02 17:34:20] – 127.0.0.1 | DEBUG | flush_multi_line是一个虚拟行,只是为了让logstash知道多行事件结束,这一行在后面被删除。
我的配置文件如下:
input { stdin{} } filter{ multiline{ pattern => "^\[" what => "prevIoUs" negate=> true } grok{ match => ['message',"\[.+\] - %{IP:ip}\|%{LOGLEVEL:loglevel}"] } if [loglevel] == "DEBUG"{ # the event flush line drop{} }else if [loglevel] == "ERROR" { # the first line of multievent grok{ match => ['message',".+\|.+\| %{PATH:file}\|%{NUMBER:line}\|%{WORD:tag}\|%{GREEDYDATA:content}"] } }else{ # its a new line (from the multi line event) mutate{ replace => ["content","%{content} %{message}"] # Supposing each new line will override the message field } } } output { stdout{ debug=>true } }
问题:
我的问题是我想将其余的多行存储到内容字段中:
The error message goes here ; array ( 'create' => array ( 'key1' => 'value1',)
所以我可以稍后删除消息字段。
@message字段包含整个多行事件,所以我尝试了mutate过滤器,替换功能就是这样,但我只是无法使其工作:(。
我不明白Multiline过滤器的工作方式,如果有人可以对此进行一些说明,那将是非常感激的。
谢谢,
阿卜杜