brancz / kube-rbac-proxy

Kubernetes RBAC authorizing HTTP proxy for a single upstream.
Apache License 2.0
584 stars 189 forks source link

Option to output the logs as JSON #251

Open SRTigers98 opened 1 year ago

SRTigers98 commented 1 year ago

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 commented 10 months ago

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 commented 5 days ago

Would be a great feature!