I am using fastapi in a container that is deployed to Kubernetes. Kubernetes offers the feature of liveness and readiness probes which are basically just HTTP get calls watched for status code <400. In fastapi it is easy to just define such an endpoint like this:
@fastapiserver.get("/healthz")
# Liveness probe for kubernetes status service
def kubernetes_liveness_probe():
return {"status": "healthy"}
However, since the probes call the endpoint quite often (~every 5 seconds) the log gets full of the calls.
How can I suppress logging for a single endpoint without losing the logging for all the others?