regex parser?


Author
Message
logphreak
logphreak
Junior Member (72 reputation)Junior Member (72 reputation)Junior Member (72 reputation)Junior Member (72 reputation)Junior Member (72 reputation)Junior Member (72 reputation)Junior Member (72 reputation)Junior Member (72 reputation)Junior Member (72 reputation)
Group: Forum Members
Posts: 7, Visits: 32
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

LogViewPlus Support
LogViewPlus Support
Supreme Being (10K reputation)Supreme Being (10K reputation)Supreme Being (10K reputation)Supreme Being (10K reputation)Supreme Being (10K reputation)Supreme Being (10K reputation)Supreme Being (10K reputation)Supreme Being (10K reputation)Supreme Being (10K reputation)
Group: Moderators
Posts: 1.2K, Visits: 4.1K
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
logphreak
logphreak
Junior Member (72 reputation)Junior Member (72 reputation)Junior Member (72 reputation)Junior Member (72 reputation)Junior Member (72 reputation)Junior Member (72 reputation)Junior Member (72 reputation)Junior Member (72 reputation)Junior Member (72 reputation)
Group: Forum Members
Posts: 7, Visits: 32
Awesome!

Thanks,
logPhreak

LogViewPlus Support
LogViewPlus Support
Supreme Being (10K reputation)Supreme Being (10K reputation)Supreme Being (10K reputation)Supreme Being (10K reputation)Supreme Being (10K reputation)Supreme Being (10K reputation)Supreme Being (10K reputation)Supreme Being (10K reputation)Supreme Being (10K reputation)
Group: Moderators
Posts: 1.2K, Visits: 4.1K
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

logphreak
logphreak
Junior Member (72 reputation)Junior Member (72 reputation)Junior Member (72 reputation)Junior Member (72 reputation)Junior Member (72 reputation)Junior Member (72 reputation)Junior Member (72 reputation)Junior Member (72 reputation)Junior Member (72 reputation)
Group: Forum Members
Posts: 7, Visits: 32
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

LogViewPlus Support
LogViewPlus Support
Supreme Being (10K reputation)Supreme Being (10K reputation)Supreme Being (10K reputation)Supreme Being (10K reputation)Supreme Being (10K reputation)Supreme Being (10K reputation)Supreme Being (10K reputation)Supreme Being (10K reputation)Supreme Being (10K reputation)
Group: Moderators
Posts: 1.2K, Visits: 4.1K
No problem. Please let me know if you have any further issues or suggestions.

...and thanks for the feedback!

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