kube-rbac-proxy icon indicating copy to clipboard operation
kube-rbac-proxy copied to clipboard

Option to output the logs as JSON

Open SRTigers98 opened this issue 1 year ago • 1 comments

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.

SRTigers98 avatar Jul 13 '23 13:07 SRTigers98

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 😅

ibihim avatar Dec 12 '23 08:12 ibihim

Would be a great feature!

lucasfcnunes avatar Oct 21 '24 21:10 lucasfcnunes