diff --git a/cloudflare-gastown/container/src/control-server.ts b/cloudflare-gastown/container/src/control-server.ts index 72e9dcbb7..fd4bbd370 100644 --- a/cloudflare-gastown/container/src/control-server.ts +++ b/cloudflare-gastown/container/src/control-server.ts @@ -126,11 +126,17 @@ app.use('*', async (c, next) => { await next(); }); -// Log method, path, status, and duration for every request +/** Paths polled too frequently to log on every request. */ +const QUIET_PATHS = new Set(['/health']); + +// Log method, path, status, and duration for every request (except noisy health polls) app.use('*', async (c, next) => { + const path = c.req.path; + if (QUIET_PATHS.has(path)) { + return next(); + } const start = performance.now(); const method = c.req.method; - const path = c.req.path; console.log(`[control-server] --> ${method} ${path}`); await next(); const duration = (performance.now() - start).toFixed(1); diff --git a/kiloclaw/src/index.ts b/kiloclaw/src/index.ts index 8f1b159ee..db563ed31 100644 --- a/kiloclaw/src/index.ts +++ b/kiloclaw/src/index.ts @@ -72,8 +72,14 @@ function flyProxyUrl(appName: string, url: URL): string { // Named middleware functions // ============================================================================= +/** Paths that fire too frequently to log on every request (health checks, telemetry). */ +const QUIET_PATHS = new Set(['/global/health', '/global/telemetry']); + async function logRequest(c: Context, next: Next) { const url = new URL(c.req.url); + if (QUIET_PATHS.has(url.pathname)) { + return next(); + } const redactedSearch = redactSensitiveParams(url); console.log(`[REQ] ${c.req.method} ${url.pathname}${redactedSearch}`); await next();