serve.admin.request_log.disable_for_health has no effect: health paths missing /admin prefix in exclusion list
Describe the bug
serve.admin.request_log.disable_for_health: true does not suppress request logs for /admin/health/ready (or /admin/health/alive).
In cmd/server/handler.go, adminServer registers httprouterx.AddAdminPrefixIfNotPresentNegroni before the reqlog middleware, so reqlog sees the already-prefixed path /admin/health/ready. But the exclusion list only contains the unprefixed health paths — the /admin prefix is applied only to the Prometheus path:
logger := reqlog.
NewMiddlewareFromLogger(d.Logger(), fmt.Sprintf("hydra/admin: %s", d.Config().IssuerURL(ctx).String()))
if cfg.RequestLog.DisableHealth {
logger.ExcludePaths(healthx.AliveCheckPath, healthx.ReadyCheckPath, "/admin"+prometheusx.MetricsPrometheusPath)
}
n.UseFunc(httprouterx.TrimTrailingSlashNegroni)
n.UseFunc(httprouterx.NoCacheNegroni)
n.UseFunc(httprouterx.AddAdminPrefixIfNotPresentNegroni)
n.UseFunc(semconv.Middleware)
n.Use(logger)So the exclusion never matches. The same file already builds both forms of these paths elsewhere (lines ~286-291), so the admin exclusion list looks like an oversight rather than a deliberate choice.
This is the mirror image of the equivalent Kratos bug (https://github.com/ory/kratos/issues/4605): there the prefix is added after reqlog while the exclusion list is prefixed.
Reproducing the bug
- Run Hydra with
SERVE_ADMIN_REQUEST_LOG_DISABLE_FOR_HEALTH=true. curl http://<admin-host>:4445/health/readyrepeatedly.- Every request is logged at
infowithmsg="completed handling request"(andmsg="started handling request").
Relevant log output
time=... level=info msg=completed handling request http_request=map[headers:map[user-agent:ELB-HealthChecker/2.0] host:10.0.0.1:4445 method:GET path:/admin/health/ready query:<nil> ...]Expected behavior
Health probes against the admin listener are not logged when disable_for_health is true.
Environment
- Hydra v26.2.0, self-hosted via
oryd/hydra:v26.2.0 - Config:
SERVE_ADMIN_REQUEST_LOG_DISABLE_FOR_HEALTH=true
Impact
Health probes dominate our Hydra log volume (~183 MB/month of CloudWatch ingestion, essentially all /admin/health/ready from ELB-HealthChecker). Hydra also logs both started and completed lines per request, which doubles it.
Suggested fix
Add "/admin"+healthx.AliveCheckPath and "/admin"+healthx.ReadyCheckPath to the admin exclusion list.
Source: ory/hydra