Hide /healthz requests from logs

4/12/2021

I'm using FastAPI in Kubernetes, is it possible to ignore /healthz messages from logs?

Like this messages:

INFO: 10.240.0.4:50754 - "GET /healthz HTTP/1.1" 204 No Content
INFO: 10.240.0.4:50760 - "GET /healthz HTTP/1.1" 204 No Content
INFO: 10.240.0.4:50884 - "GET /healthz HTTP/1.1" 204 No Content
INFO: 10.240.0.4:50892 - "GET /healthz HTTP/1.1" 204 No Content
INFO: 10.240.0.4:51072 - "GET /healthz HTTP/1.1" 204 No Content
INFO: 10.240.0.4:51096 - "GET /healthz HTTP/1.1" 204 No Content
INFO: 10.240.0.4:51244 - "GET /healthz HTTP/1.1" 204 No Content
INFO: 10.240.0.4:51250 - "GET /healthz HTTP/1.1" 204 No Content
INFO: 10.240.0.4:51438 - "GET /healthz HTTP/1.1" 204 No Content
INFO: 10.240.0.4:51444 - "GET /healthz HTTP/1.1" 204 No Content

Because sometimes I want to check when was the service contacted last time, I'm looking for logs, but logs are full of /healthz, then I need to apply some kind of filter.

What should be the best practice for these cases?

Thanks

-- Rui Martins
fastapi
kubernetes

0 Answers