1

我在日志文件中有一个系统日志列表,在其中我必须根据某些条件计算两个特定日志之间的时间差

@timestamp                      message  

May 19th 2016, 02:55:29.003     just some log
May 19th 2016, 02:55:29.003     retired 2 times
May 19th 2016, 02:55:29.200     System1 down -------
May 19th 2016, 02:55:29.205     just some log  
May 19th 2016, 02:55:29.453     System1 up ----
May 19th 2016, 02:55:39.200     System2 down 
May 19th 2016, 02:55:49.205     just some log  
May 19th 2016, 02:55:53.453     System2 up  -------
May 19th 2016, 02:55:58.453     all done

例如在提到的日志中,当我们在某些日志中看到消息“重试”时,我们需要触发计算。

在看到消息时,它应该开始计算与包含“System1 Down”消息的紧随消息的差异,直到它看到“System1 Up”消息。但这里的问题是系统消息可以像“System1”或“System1”一样是动态的'系统2'

如果它以 'System1 Up' 开头,它应该计算到 'System1 Down' 的时间,并且对于 'System2 Up' 也是如此。是否有可能在logstash中使用正则表达式。

当它在消息中看到“全部完成”时,所有过程都应该停止。如果在随后出现的任何日志中看到“已退休 2 次”,则应重新开始计算时差。

我厌倦了在 Logstash 和聚合中使用 elapsed 插件,但不确定,它不适用于这种流程。

这样做最好是什么?在 Logstash、弹性搜索或 Kibana 中。提前致谢

4

0 回答 0