Parsing words as log level based of first few letters


Author
Message
Teresa
Teresa
New Member (10 reputation)New Member (10 reputation)New Member (10 reputation)New Member (10 reputation)New Member (10 reputation)New Member (10 reputation)New Member (10 reputation)New Member (10 reputation)New Member (10 reputation)
Group: Forum Members
Posts: 2, Visits: 2
Hi!
I have a log file designed (poorly) as follows:

3 2020-04-09 10:57:58 Doing a first pass over 353 file(s).
3 2020-04-09 10:57:58 Skipping file C:\Users\...  
7 2020-04-09 10:57:58 - Found tag number...
3 2020-04-09 10:58:01 Created Acquisition...  
3 2020-04-09 10:59:16 Warning: There are elements...
There is no explicit log level for the first two entries. The words "Doing", "Skipping" and "Created" are parsed as if they were a log level DEBUG, SEVERE and CRITICAL respectively.
What I would like is to have an UNKNOWN level for those, as it is for the dash "-" before "Found tag number.."
Here's my config  %t %d{yyyy-MM-dd %H:mm:ss} %p %m%n

Thank you!

/Teresa
LogViewPlus Support
LogViewPlus Support
Supreme Being (5.3K reputation)Supreme Being (5.3K reputation)Supreme Being (5.3K reputation)Supreme Being (5.3K reputation)Supreme Being (5.3K reputation)Supreme Being (5.3K reputation)Supreme Being (5.3K reputation)Supreme Being (5.3K reputation)Supreme Being (5.3K reputation)
Group: Moderators
Posts: 1.1K, Visits: 3.7K
Hi Teresa,

I think a multi-pattern would be appropriate for this scenario.  In this case, your configuration could be:
%t %d{yyyy-MM-dd %H:mm:ss} %p: %m%n
%t %d{yyyy-MM-dd %H:mm:ss} %m%n

This should work most of the time, but you may run into difficulties if you have a ": " in log entries without a priority.  The only alternative I can think of would be to create a Custom Parser

Hope that helps,

Toby
Teresa
Teresa
New Member (10 reputation)New Member (10 reputation)New Member (10 reputation)New Member (10 reputation)New Member (10 reputation)New Member (10 reputation)New Member (10 reputation)New Member (10 reputation)New Member (10 reputation)
Group: Forum Members
Posts: 2, Visits: 2
Thanks Toby! That was fast Smile

I've tried your suggestion but the log I have actually have too many weird stuff so that config doesn't apply to the entire file.
I'll experiment with VS a bit, thanks for the tip!

/Teresa
LogViewPlus Support
LogViewPlus Support
Supreme Being (5.3K reputation)Supreme Being (5.3K reputation)Supreme Being (5.3K reputation)Supreme Being (5.3K reputation)Supreme Being (5.3K reputation)Supreme Being (5.3K reputation)Supreme Being (5.3K reputation)Supreme Being (5.3K reputation)Supreme Being (5.3K reputation)
Group: Moderators
Posts: 1.1K, Visits: 3.7K
Unfortunately, it is very difficult to parse situations which occur 'sometimes'.  We have some ideas on how to improve things, but we are probably looking at several months before release.

In this case, it may be that the structure of your log file cannot be accurately described beyond:  %t %d{yyyy-MM-dd %H:mm:ss} %m%n

Thanks,

Toby
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Login

Explore
Messages
Mentions
Search