Use Pattern Parser with variable spaces count


Author
Message
Patrick Dawson
Patrick Dawson
New Member (41 reputation)New Member (41 reputation)New Member (41 reputation)New Member (41 reputation)New Member (41 reputation)New Member (41 reputation)New Member (41 reputation)New Member (41 reputation)New Member (41 reputation)
Group: Forum Members
Posts: 5, Visits: 34
Hi there. I have a problem when parsing logfiles that contain lines with a variable count of spaces between words. Our logging framework inserts a variable count of spaces (not tabs) between the loglevel and the message like in this example:

2022.07.06-00:33:10.511 - warn: A warning
2022.07.06-00:33:10.623 - info: Some info
2022.07.06-00:33:12.743 - error: This is an error

The error line has fewer spaces than info or warn lines. The only pattern for the pattern parser that works for me is:
%d{yyyy.MM.dd-HH:mm:ss.fff} - %p:%m%n

The only "problem" with this pattern is that the message is not trimmed meaning there are leading spaces. Is there a way to eliminate these leading spaces?
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Login

Explore
Messages
Mentions
Search