简体   繁体   English

如何编写自定义的grok模式?

[英]How to write a custom grok pattern?

I have a log sample in log file. 我在日志文件中有一个日志示例。 I want to write a grok pattern in a logstash configuration file. 我想在logstash配置文件中编写一个grok模式。
Please suggest me the possible right way to write the grok pattern for the same. 请为我建议编写相同的grok模式的正确方法。

2019-01-10 15:33:38.365  INFO 4228 --- [http-nio-8080-exec-6] c.e.h.e.ELKController: /elkdemo - > Hello user ! Thu Jan 10 15:33:38 IST 2019

Depends on the fields you want to extract. 取决于要提取的字段。

Suggestion : 建议:

grok {match => [
        "message" , "%{YEAR:year}-%{MONTHNUM:month}-%{MONTHDAY:day} %{TIME:time} %{LOGLEVEL:logLevel} %{NUMBER:id} --- %{DATA:thread} %{DATA:operation} %{GREEDYDATA:thread}"
        ]
}

You can debug your pattern here 您可以在此处调试模式

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

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