LogViewPlus Support

Parsing words as log level based of first few letters

https://www.logviewplus.com/forum/Topic494.aspx

By Teresa - 9 Apr 2020

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
By LogViewPlus Support - 9 Apr 2020

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
By Teresa - 9 Apr 2020

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
By LogViewPlus Support - 9 Apr 2020

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