LogViewPlus Support

regex parser?

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

By logphreak - 30 Jan 2019

Hi.

Maybe I just haven't discovered how to do it yet, but is there any way to parse a logfile using standard regular expressions?

Thanks,
logPhreak
By LogViewPlus Support - 30 Jan 2019

Hi logPhreak,

A regex parser is a good idea.  It is not something that we currently support as we have found the PatternParser sufficient for most log files.  However the PatternParser does have a learning curve and some of our customers are already familiar with regex - so I think a regex parser makes sense.

We are a bit late in the current release cycle, but I think this is something we can look into for the following release.

Thanks,

Toby
By logphreak - 30 Jan 2019

Awesome!

Thanks,
logPhreak
By LogViewPlus Support - 24 Apr 2019

Hi logPhreak,

I just wanted to let you know that we have added a new RegexParser to the latest BETA release of LogViewPlus - v2.3.6. The RegexParser has a significant performance disadvantage compared to the PatternParser, but it also offers a lot more power and parsing flexibility so I think it is a great addition.

The RegexParser is based on named groups where the name of the group corresponds to the name of a conversion specifier (see: https://www.logviewplus.com/docs/advanced_specifiers.html ).  You can also just use a random name and this will be treated as a "string" column.

For example, the log line:
2018-02-13 00:50:38,282 [Thread_13] TRACE MessageBus - Executing SQL statements.

Could be parsed with:
(?<date>.*?) \[(?<thread>.*?)\] (?<priority>.*?) (?<logger>.*?) - (?<message>.*)

Alternatively, if the date format is not recognized automatically, you could use:
(?<date{yyyy-MM-dd %H:mm:ss,fff}>.*?) \[(?<thread>.*?)\] (?<priority>.*?) (?<logger>.*?) - (?<message>.*)

I hope that makes sense.  Documentation for this feature is still pending.  Please let me know if you have any questions or issues.

Thanks for the feedback!

Toby
By logphreak - 25 Apr 2019

Thank you for adding this feature!  I am busy with other projects at the moment, but will give it a try as soon as I can.

Thanks,
logPhreak
By LogViewPlus Support - 25 Apr 2019

No problem. Please let me know if you have any further issues or suggestions.

...and thanks for the feedback!

Toby