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

Option to output the logs as JSON #251

Open
SRTigers98 opened this issue Jul 13, 2023 · 3 comments
Open

Option to output the logs as JSON #251

SRTigers98 opened this issue Jul 13, 2023 · 3 comments

Comments

@SRTigers98
Copy link

For the automatic collection of logs using a service such as Filebeat, it would be helpful if the logs could be output as JSON, e.g. by using a flag.
For example, you could use the JSON logging format from the Kubernetes Community Repository.

{"ts": 1580306777.04728,"v": 4,"msg": "Pod status was updated","pod":{"name": "kube-dns","namespace": "kube-system"},"status": "ready"}

The concrete use case is that the RBAC proxy runs in a pod together with a controller manager for a custom operator (created with kubebuilder).
The controller manager created with kubebuilder uses the zap logging library and it can be configured to use JSON as logging format.
It would be nice if the rbac proxy would also log using JSON logging, so that both containers in the pod use the same logging format.
This would allow Filebeat to easily collect the logs from both containers in the pod.

@ibihim
Copy link
Collaborator

ibihim commented Dec 12, 2023

Hi,

I've seen this issue long time ago, but never came back to it. Sorry for the delay. I will try to take a look next month.

This is a thing that we most probably will make happen at some point 😅

@lucasfcnunes
Copy link

Would be a great feature!

@stlaz
Copy link
Collaborator

stlaz commented Nov 11, 2024

klog has support for structured logging (see klog.InfoS and similar). This would be a logical follow-up once the upstream sig-auth adopts this repo.

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

No branches or pull requests

4 participants