Skip to content

ClickHouseClient.logDebugQuery writes per-query SQL via raw console.debug — floods pod logs, no env gate #2416

@olexiyb

Description

@olexiyb

HyperDX version: 2.28.0 (also reproduces on 2.27.0)
Chart: clickstack/clickstack 3.0.0
Deployment: Self-hosted via Helm

Symptom

Every time the HyperDX UI runs a ClickHouse query (autocomplete suggestions, filter dropdowns, source field probes, search/dashboard render) the API container writes three lines to stdout:

[API] --------------------------------------------------------
[API] Sending Query: <full SQL with parameters interpolated>
[API] --------------------------------------------------------

A single search interaction produces dozens of these. With OTel log capture wired up (DaemonSet tailing /var/log/pods/*), this dominates the log shipper and ClickHouse otel_logs retention.

Setting HYPERDX_LOG_LEVEL=warn (or error) does not suppress it.

Source

In @hyperdx/common-utils 0.19.x / 0.20.0, the ClickHouse client class (built into chunk-SZLXGC2R.js on 2.27.0 / chunk-25WT7LWK.js on 2.28.0):

logDebugQuery(t, n = {}) {
  let r = "";
  try { r = Ae({sql: t, params: n}) } catch(e) { r = t }
  console.debug("--------------------------------------------------------"),
  console.debug("Sending Query:", r),
  console.debug("--------------------------------------------------------")
}

The call is unconditional — it doesn't go through the Pino logger that handles every other log statement in the codebase (#1269 migrated the rest), and it isn't gated on HYPERDX_LOG_LEVEL, NODE_ENV, or any other env var I could find.

Suggested fix

Either:

  1. Route through the existing Pino debug logger so HYPERDX_LOG_LEVEL controls it consistently with everything else, or
  2. Gate behind an opt-in env var (e.g. HDX_LOG_QUERIES=true) — off by default in prod, since the per-query SQL dump is really only useful when actively debugging.

Current workaround

Mount a 4-line console.debug = () => {} preload via NODE_OPTIONS=--require=.... Effective but ugly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions