goatcounter
goatcounter copied to clipboard
Add option for structured logs
I'm currently using release 1.3 self hosted on Google Cloud Platform's GKE. I would love to be able to tell goatcounter to log in json or another structured log format.
Note that the current output is structured already in the form of:
TIME [optional module] LEVEL: message {key=value [..]}
Where value
is either just a number, true
/false
, or a "string"
. IMO this is a good trade-off between human-readable and "structured" logging.
I don't really know what would work with GKE (whatever that even is hah), but it should be easy to create a new logging output for zlog in any format you want; there's an example in output_std.go
(which is the above format) and as zlog_sentry. Just need to think of a -log
flag and a format for that.
~I too would like support for JSON logs, specifically for Caddy 2 HTTP Server. I am actually building this feature for myself right now with a little adapter. I will keep this issue updated with my progress.~
ooops i can't read, this issue thread is about log OUTPUT not reading log INPUT
This is about goatcounter outputting to JSON logs, not about reading them from JSON files. I created a new issue for that: #446