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

Replaced 'winston-logfmt' by 'winston' package. #3

Merged
merged 3 commits into from
Nov 24, 2023

Conversation

jeroenvermeulen
Copy link
Contributor

Fixes #2

Copy link
Owner

@paulrostorp paulrostorp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's an important requirement to maintain structured logging.
I don't have the bandwidth to fix the logfmt implementation atm, but maybe you could enable the Winston builtin json logger ?

@jeroenvermeulen
Copy link
Contributor Author

@paulrostorp With the winston package it logs like this:

debug: Starting Bunny CDN Operator...
info: watching resource edgerules.bunny-cdn-operator.com/v1alpha1
info: watching resource storagezones.bunny-cdn-operator.com/v1alpha1
info: watching resource pullzones.bunny-cdn-operator.com/v1alpha1
debug: Bunny CDN Operator started.
debug: Processing change to Pull Zone local-app-cloud...

Isn't that structured enough?

@paulrostorp
Copy link
Owner

paulrostorp commented Nov 23, 2023

@paulrostorp With the winston package it logs like this:

debug: Starting Bunny CDN Operator...
info: watching resource edgerules.bunny-cdn-operator.com/v1alpha1
info: watching resource storagezones.bunny-cdn-operator.com/v1alpha1
info: watching resource pullzones.bunny-cdn-operator.com/v1alpha1
debug: Bunny CDN Operator started.
debug: Processing change to Pull Zone local-app-cloud...

Isn't that structured enough?

@jeroenvermeulen That isn't a structure log management tools support by default and can index+search easily. Most log management tools have built-in support logfmt and json logs, including Grafana Loki which I use.

Winston's JSON logger will suffice: https://github.com/winstonjs/winston#usage

@jeroenvermeulen
Copy link
Contributor Author

@paulrostorp Updated PR. Now it logs like this:

{"level":"debug","message":"Starting Bunny CDN Operator..."}
{"level":"info","message":"watching resource edgerules.bunny-cdn-operator.com/v1alpha1"}
{"level":"info","message":"watching resource storagezones.bunny-cdn-operator.com/v1alpha1"}
{"level":"info","message":"watching resource pullzones.bunny-cdn-operator.com/v1alpha1"}
{"level":"debug","message":"Bunny CDN Operator started."}
{"level":"debug","message":"Processing change to Pull Zone local-app-cloud..."}

@paulrostorp paulrostorp merged commit d4a12f9 into paulrostorp:main Nov 24, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

If an error occurs the pod gets OOMkilled
2 participants