Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow configuration of logging encoding #290

Closed
sapslaj opened this issue Jan 25, 2024 · 3 comments
Closed

Allow configuration of logging encoding #290

sapslaj opened this issue Jan 25, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@sapslaj
Copy link

sapslaj commented Jan 25, 2024

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.

@sapslaj sapslaj added the enhancement New feature or request label Jan 25, 2024
bakito added a commit that referenced this issue Jan 26, 2024
bakito added a commit that referenced this issue Jan 26, 2024
* support for json logs #290
@bakito
Copy link
Owner

bakito commented Jan 26, 2024

Hi @sapslaj

This will be part of the next release.

@bakito bakito closed this as completed Jan 26, 2024
@bakito
Copy link
Owner

bakito commented Jan 31, 2024

Is released with https://github.com/bakito/adguardhome-sync/releases/tag/v0.6.4

@sapslaj
Copy link
Author

sapslaj commented Feb 2, 2024

Just updated and it's working like a charm!

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants