Exclude certain requests from access log (e.g. health-check)

I’m wondering if it’s possible to configure the uvicorn access loging with exclusions, either by path, or even by user-agent.

Specifically, I want to avoid cluttering the access logs with health-checks and pings (i.e. pingdom, nagios, googlebot)

No, it is not possible and is out of scope of uvicorn, imho.
You can achieve that by filtering on frontend server side (eg. nginx, traefik, etc).

See https://serverfault.com/questions/45353/nginx-access-logs-ignore-certain-requests for example.

1 Like