简体   繁体   English

特殊字符的Logstash grok

[英]Logstash grok for special character

Following is my log 以下是我的日志

# Time: 2017-11-02T07:41:22.631956Z# User@Host: root[root] @ localhost []  Id:     

I am not able to write grok pattern for the word root[root] . 我无法为词root[root]编写grok模式。 I want this value as a single column. 我希望将此值作为单列。 Example : host = root[root] . 示例: host = root[root]

I want [ in my value. 我要[以我的价值。

How to do this ? 这个怎么做 ?

%{DATA:user} should do. %{DATA:user}应该这样做。

You can see the definition for DATA here . 您可以在此处查看DATA的定义。

A grok filter for parsing your whole logline could look somewhat like this (I'm not really sure which parts you're interested in but you get the idea): 用于解析整个日志行的grok过滤器可能看起来像这样(我不太确定您对哪些部分感兴趣,但您知道了):

# Time: %{TIMESTAMP_ISO8601:timestamp}# %{DATA:user}@%{DATA:host}: %{DATA:user2} @ %{DATA:host2} \[\]  Id:

Results from https://grokconstructor.appspot.com : 来自https://grokconstructor.appspot.com的结果: 在此处输入图片说明

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

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