goodeggs / heroku-log-normalizer

Normalize log lines from Heroku Logplex to JSON.
1 stars 0 forks source link

Preserve logfmt-style data #11

Open aseemk opened 9 years ago

aseemk commented 9 years ago

As mentioned in https://github.com/goodeggs/bites/issues/20#issuecomment-143237021, it'd be great to preserve the structure of e.g. Heroku router logs:

at=info method=GET path="/" host=corp-myapp.herokuapp.com request_id=deaa77fa-c9c8-4eed-a8d2-867ee4e85317 fwd="107.127.127.127,199.127.127.127" dyno=web.2 connect=2ms service=39ms status=200 bytes=745586

Logfmt parsing module from Heroku dev:

https://github.com/csquared/node-logfmt

However, as the parsing section notes, numeric values are not parsed to numbers. So "bytes": "745586" would get sent, not "bytes": 745586.

But that might just have to be a limitation of this. I'll file an issue on the logfmt module that perhaps it could still attempt to parse numbers, and only fallback to string if precision loss was detected.

WDYT?

aseemk commented 9 years ago

https://github.com/csquared/node-logfmt/issues/33

bobzoller commented 9 years ago

yeah we did this at one point. you can probably find it in the git history. as long as the solution accounts for unstructured log lines (!json && !logfmt), I'd be happy to accept a PR.

On Fri, Sep 25, 2015 at 7:40 AM, Aseem Kishore notifications@github.com wrote:

csquared/node-logfmt#33 https://github.com/csquared/node-logfmt/issues/33

— Reply to this email directly or view it on GitHub https://github.com/goodeggs/heroku-log-normalizer/issues/11#issuecomment-143240917 .