Our current log format is nicely dense, and our engineers are used to it. According to @piyush-singh, the format can be daunting for users, some of whom have wished that we logged in more of a standard format. There is a lot of information and it isn't self-documenting in each log message.
It's becoming increasingly common for services to log in structured JSON. The CockroachDB server should accept a log format flag that permits our default and also structured JSON. When the log format is set to JSON, we should emit a JSONified payload. For example, instead of
I200205 15:42:44.792844 299 server/status/runtime.go:498 [n1] runtime stats: 177 MiB RSS, 206 goroutines, 68 MiB/50 MiB/116 MiB GO alloc/idle/total, 55 MiB/73 MiB CGO alloc/total, 27.4 CGO/sec, 0.6/0.5 %(u/s)time, 0.0 %gc (0x), 39 KiB/39 KiB (r/w)net
We'd output
{"severity": "info", "timestamp": "20200205 15:42:44.792844", "thread": 299, "line": "server/status/runtime.go:498", "node": 1, "message": "runtime stats: 177 MiB RSS, 206 goroutines, 68 MiB/50 MiB/116 MiB GO alloc/idle/total, 55 MiB/73 MiB CGO alloc/total, 27.4 CGO/sec, 0.6/0.5 %(u/s)time, 0.0 %gc (0x), 39 KiB/39 KiB (r/w)net"}
This should be relatively straightforward, and allow for easy log ingestion into observability systems like Splunk or Datadog.
Our current log format is nicely dense, and our engineers are used to it. According to @piyush-singh, the format can be daunting for users, some of whom have wished that we logged in more of a standard format. There is a lot of information and it isn't self-documenting in each log message.
It's becoming increasingly common for services to log in structured JSON. The CockroachDB server should accept a log format flag that permits our default and also structured JSON. When the log format is set to JSON, we should emit a JSONified payload. For example, instead of
We'd output
This should be relatively straightforward, and allow for easy log ingestion into observability systems like Splunk or Datadog.