简体   繁体   English

自定义模式

[英]Grok custom pattern

I have the simple message coming in my logstash: 我的logstash中有一条简单的消息:

2018-09-30 20:25:07.708  INFO 8013 --- [nio-8443-exec-3] c.e.demo.controller.UsuarioController    : INICIO CHAMADA | 311

I want to remove the following field from this message. 我想从此消息中删除以下字段。

"311"

在此处输入图片说明

You're almost there. 你快到了。 You simply need to escape the pipe | 您只需要逃脱管道| character with a backslash (otherwise it matches the 801 after INFO ), like this: 带有反斜杠的字符(否则,它与INFO之后的801匹配),如下所示:

: INICIO CHAMADA \| (?<identificador_chamada>[0-9]{3})
                 ^
                 |
             add this

and you'll get this 你会得到这个

{
  "identificador_chamada": [
    "311"
  ]
}

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

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