You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I use Loki for centralized logs in my homelab. Loki has some nice functions for parsing and querying structured logs. Being able to output logs in logfmt, or more ideally JSON, would be very handy for querying and building alerting rules off of and such.
Describe the solution you'd like*
Zap already has support for outputting JSON logs, you just have to set the encoding to "json" in the zap.Config. Either a config option, flag, or environment variable could be used, like LOG_FORMAT or similar. Since logging has to be initialized pretty early we could also limit that setting to an environment variable similar to how LOG_LEVEL is used currently.
Describe alternatives you've considered
No response
Anything else?
I'd be happy to submit a PR for this if that makes your life easier.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
I use Loki for centralized logs in my homelab. Loki has some nice functions for parsing and querying structured logs. Being able to output logs in logfmt, or more ideally JSON, would be very handy for querying and building alerting rules off of and such.
Describe the solution you'd like*
Zap already has support for outputting JSON logs, you just have to set the encoding to
"json"
in thezap.Config
. Either a config option, flag, or environment variable could be used, likeLOG_FORMAT
or similar. Since logging has to be initialized pretty early we could also limit that setting to an environment variable similar to howLOG_LEVEL
is used currently.Describe alternatives you've considered
No response
Anything else?
I'd be happy to submit a PR for this if that makes your life easier.
The text was updated successfully, but these errors were encountered: