kubetail-org / kubetail

Web-based, real-time log viewer for Kubernetes
https://www.kubetail.com/demo
Apache License 2.0
301 stars 16 forks source link

Exclude `/healthz` from access logs #26

Closed jkroepke closed 4 months ago

jkroepke commented 4 months ago

Consider to exclude /healthz from access logs. It's really spammy, the kubernetes probes are active.

{"level":"info","request_id":"5766be9e-1f57-4140-9114-48f6f7192e51","event_type":"Access","request_ts":"2024-03-01T16:41:01.925443928Z","remote_addr":"10.0.240.14:39162","method":"GET","proto":"HTTP/1.1","scheme":"","host":"10.0.240.141:4000","path":"/healthz","raw_query":"","content_length":"","user_agent":"kube-probe/1.27","referer":"","x_forwarded_for":"","x_forwarded_host":"","x_forwarded_proto":"","upgrade":"","sec_websocket_protocol":"","status_code":200,"duration_ms":0.050378,"resp_content_length":"","time":"2024-03-01T16:41:01.925498061Z"}
amorey commented 4 months ago

Yes, this would be helpful. It would be easy to exclude it here if you want to take a crack at it sooner than I can get to it: https://github.com/kubetail-org/kubetail/blob/main/backend/internal/ginapp/middleware.go#L85

amorey commented 4 months ago

Here's a PR that implements this: https://github.com/kubetail-org/kubetail/pull/27. Once implemented you would enable it by using the logging.access-log.hide-health-checks config option (default: false):

logging:
  access-log:
    hide-health-checks: true

Let me know if you have any suggestions.

jkroepke commented 4 months ago

Looks good

amorey commented 4 months ago

I published a new version with this (0.2.0) and also updated the helm chart (0.3.1). Let me know if you run into any problems.