roidrage/lograge — pull request #19 by meineerde (2012-11-12 19:06:50+00:00)
Title: Optional create Log events in Logstash's json_event format

This pull request adds a new configuration option called `Lograge.log_format` which allows to configure the generated log format: either the (default) `:lograge` format you defined, or the json_event format used by Logstash called `:logstash`.

Using this format, you gain proper JSON which is even more simple to parse than the default format (because, there are actual parsers) and you get a proper timestamp. Generally, when using this option together with logstash, you don't need any grock patterns but can use the raw logs.

Internally, the whole log event generation was moved to use an actual hash throughout and only creating the actual log line at the very end by joining the data to a string or well, into JSON.

During handling of the lograge format, I stumbled over two difficulties, both of which might be addressed in a separate change:

* You expect always 0 decimals in numerics, even if one could suffice. I think parsers would already have to deal with variable length numerics, so this requirement could be dropped.
* The error message is not fully escaped. A parser could be confused if the error message contains a single quote. Also, the error message is the only field which is quoted and behaves a bit too special for my taste.