Parse Monologfiles

For debugging reasons I'm writing extensive logfiles of API calls with guzzle.

For that I'm using Seldaek/monolog. Beside writing a log message, I add all the headers and bodies as JSON in the context field.

The logfiles are being parsed with and ddtraceweb/monolog-parser and can be accessed through the web app.

With heavy use of the app, large JSON objects are being written, a daily log can grow up to 400MB and this of course makes parsing the file impossible.

There are better ways to analyze logfiles and that's on the local machine without network overhead, enough RAM and a nice GUI with pretty print.

I found that software in LogViewPlus. It takes large logfiles, parses them and then you can filter by date, sort, search and get a better picture of the data you are analyzing.

There is a wizard that analyzes your data and in my case, it lumped the message data and the context into one field, so i had to write a custom regex parser.

To be honest, I didn't write it, I just looked up the parser of the php parser library and tweaked it a bit to make it work.


This is what it looks like.

\[(?<date>.*?)\] (?<logger>\w+).(?<level>\w+): (?<message>[^\[\{]+) (?<context>[\[\{].*[\]\}]) (?<extra>[\[\{].*[\]\}])

So, LogViewPlus is a nice piece of software that makes analyzing logfiles pretty easy.