motis icon indicating copy to clipboard operation
motis copied to clipboard

JSON Logging

Open felixguendling opened this issue 2 years ago • 4 comments

Example:

{
    "time": "2022-03-08T09:32:20.685+00:00",
    "severity": "WARN",
    "logger": "dispatcher.cc:121",
    "msg": "target not found: /metrics"
}

felixguendling avatar Mar 08 '22 11:03 felixguendling

It would be great if the format would follow one of the (many) conventions out there, including the question how to deal with additional fields.

derhuerst avatar Mar 08 '22 17:03 derhuerst

I can't find something like a real standard / RFC on JSON logging. Which format would you prefer? There's a lot of content about JSON logging out there but everybody seems to name fields in a different way, have different formats for timestamps, etc.

I think this looks good to me: https://nodejs.org/en/blog/module/service-logging-in-json-with-bunyan/

felixguendling avatar Mar 08 '22 17:03 felixguendling

I can't find something like a real standard / RFC on JSON logging.

Yeah, me too. Nothing fully established.

Which format would you prefer?

I like to use pino in the Node.js world, which logs in a format very similar to the well-known bunyan.

I also found the Google Cloud schema.

derhuerst avatar Mar 08 '22 19:03 derhuerst

Makes sense. Being compatible to bunyan and/or pino would have the benefit of being able to use their pretty-print tools. Sounds great! :rocket:

felixguendling avatar Mar 08 '22 21:03 felixguendling