From f364d02bba67607252e4a9352be8ebe077fa5edd Mon Sep 17 00:00:00 2001 From: "kiloconnect[bot]" <240665456+kiloconnect[bot]@users.noreply.github.com> Date: Thu, 2 Apr 2026 21:59:58 +0000 Subject: [PATCH] fix(logging): exclude noisy health/telemetry paths from request logs /global/health and /global/telemetry requests fire very frequently (health polls, telemetry pings) and flood worker logs. Add a QUIET_PATHS set to skip logging for these high-frequency paths in both the KiloClaw worker and the gastown container control server. --- cloudflare-gastown/container/src/control-server.ts | 10 ++++++++-- kiloclaw/src/index.ts | 6 ++++++ 2 files changed, 14 insertions(+), 2 deletions(-) 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();