目前我有:
multiline {
type => "tomcat"
pattern => "(^.+Exception: .+)|(^\s+at .+)|(^\s+... \d+ more)|(^\s*Caused by:.+)|(---)"
what => "previous"
}
这是我日志的一部分:
TP-xxxxxxxxxxxxxxxxxxxxxxxx: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
at xxxxxx
Caused by: xxxxxxxxx
at xxxxxx
Caused by: xxxxxxxxx
--- The error occurred in xxxxxxxxx.
--- The error occurred xxxxxxxxxx.
我的模式在这里不起作用。可能是因为我在末尾添加了 (---)。添加 --- 行的正确正则表达式是什么?
谢谢
最佳答案
您还需要考虑该行中的其他字符:
(^---.*$)
关于regex - 多行的正则表达式模式是什么(logstash),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24286735/