我应该如何为下面的日志模式定义grok匹配模式

时间:2018-06-18 13:00:39

标签: elasticsearch logstash logstash-grok

我正在使用的日志模式

2018-06-18 18:25:25.424 ERROR 2688 --- [io-8052-exec-16] c.l.o.u.s.i.ClientCallbackServiceImpl   , 239 : Unable to inform client about the order callback status: Exception occured is: {}

1 个答案:

答案 0 :(得分:0)

你真的不需要grok,你可以简单地使用dissect {}

所以,如果你的消息是:

2018-06-18 18:25:25.424 ERROR 2688 --- [io-8052-exec-16] c.l.o.u.s.i.ClientCallbackServiceImpl , 239 : Unable to inform client about the order callback status: Exception occured is: {}

然后你的解剖会像这样,小心保存空间:

dissect {
  mapping => {
    "message" => "%{date} %{time} %{log_level} %{log_level_code} --- [%{process}] %{class} , %{line} : %{log_message}"
  }
}

然后,您需要使用date将字段timemutate合并到另一个字段中,并使用date过滤器将其设为时间戳。

mutate {
    add_field => {"log_date" => "%{date} %{time}"}
}
date {
    match => [ "log_date", "yyyy-MM-dd HH:mm:ss.SSS" ]
}
相关问题