goatcounter icon indicating copy to clipboard operation
goatcounter copied to clipboard

Add option for structured logs

Open icco opened this issue 4 years ago • 3 comments

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.

icco avatar Jun 20 '20 18:06 icco

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.

arp242 avatar Jun 20 '20 18:06 arp242

~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

ForestJohnson avatar Mar 09 '21 19:03 ForestJohnson

This is about goatcounter outputting to JSON logs, not about reading them from JSON files. I created a new issue for that: #446

arp242 avatar Mar 10 '21 09:03 arp242