Reputation: 51
Currently I have:
multiline {
type => "tomcat"
pattern => "(^.+Exception: .+)|(^\s+at .+)|(^\s+... \d+ more)|(^\s*Caused by:.+)|(---)"
what => "previous"
}
and this is part of my log:
TP-xxxxxxxxxxxxxxxxxxxxxxxx: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
at xxxxxx
Caused by: xxxxxxxxx
at xxxxxx
Caused by: xxxxxxxxx
--- The error occurred in xxxxxxxxx.
--- The error occurred xxxxxxxxxx.
My pattern doesn't work here. Probably because i added the (---) at the end. What is the correct regexp to also add the --- lines?
Thanks
Upvotes: 5
Views: 2609
Reputation: 3710
I have put your regex and text into these online regex buddies and tried the suggestion of Eric:
Sometimes these online buddies really help to clear the mind. This picture shows what is recognized:
If I were stuck on this, I wouldn't focus on the regex itself any further. Rather I'd check these points:
Upvotes: 2
Reputation: 7890
If one log event start with a timestamp or a specific word, for example, in your logs if all logs start with TP
, then you can use it as filter pattern.
multiline {
pattern => "^TP"
what => "previous"
negate => true
}
With this filter you can multiline your logs easy, no need to use complex patterns.
Upvotes: 1
Reputation: 3959
You'll want to account for the other characters on the line as well:
(^---.*$)
Upvotes: 2