Good library for parsing log files (web servers, php errors ...)

Hello, I want to write my first “real world” haskell application, I’m a web developper and often to debug a problem in production I have to correlates log entries (web server, php errors, session, you name it …)
I know that Haskell is really good at parsing things but I prefer to use an opinionated library that parses log files than writing my own parser with a library like parsec … What would you use for this purspose : parse log files and relate them based on the events date/time.

Thanks

2 Likes

I think the answer depends on the structure of your logs. If you use json encoding, you may use one of the json libraries, like aeson. If your logs are unstructured / follow your own custom formatting, then writing a parser yourself might be a good option.

As you said, Haskell is well suited for parsing, so writing your own lightweight parser is not such a bad idea; many projects do it on an ad-hoc basic.

2 Likes

Is it your application itself that will be parsing logs, or do you want something separate that parses the logs of your application?

For the latter I’d probably use an existing tool like Grafana Loki if I really needed something battle-tested. Otherwise you will spend all your time writing a competitor to Loki without ever writing your original application. :slight_smile:

1 Like