From 3ae6b808d80090de62af5bbc590cc856a583c5aa Mon Sep 17 00:00:00 2001 From: Sharang Parnerkar <30073382+mighty840@users.noreply.github.com> Date: Thu, 29 Oct 2026 12:43:21 +0100 Subject: [PATCH] fix(telemetry): console logs to WARN+ while logs go out over OTLP MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With OTLP export on, SigNoz got every Prüfwerk line twice: the OTLP record (structured, severity, trace context) and the node agent's copy of stdout (plain text, often without severity). The console layer now filters with LOG_CONSOLE (default warn) in that mode; INFO reaches SigNoz over OTLP only. Without OTLP the console is unchanged. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01KYcAAeTw22GE9QPzDM8yc4 --- compliance-core/src/telemetry.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/compliance-core/src/telemetry.rs b/compliance-core/src/telemetry.rs index 17d26f1..e31d896 100644 --- a/compliance-core/src/telemetry.rs +++ b/compliance-core/src/telemetry.rs @@ -13,6 +13,7 @@ //! | `OTEL_EXPORTER_OTLP_ENDPOINT` | OTLP collector endpoint (e.g. `https://otel.example.com`) | *(disabled)* | //! | `OTEL_SERVICE_NAME` | Service name for resource | `service_name` param | //! | `RUST_LOG` / standard `EnvFilter` | Log level filter | `info` | +//! | `LOG_CONSOLE` | Console (stdout) filter while OTLP export is on; the logs reach SigNoz via OTLP, so the console copy is only a fallback | `warn` | use opentelemetry::global; use opentelemetry::trace::TracerProvider as _; @@ -123,9 +124,16 @@ pub fn init_telemetry(service_name: &str) -> TelemetryGuard { .add_directive("h2=off".parse().unwrap_or_default()) .add_directive("reqwest=off".parse().unwrap_or_default()); + // The OTLP log records are the copy SigNoz uses (structured, with + // severity and trace context). The node agent also ships stdout, so + // a full console copy would store every line twice; keep it to + // warnings and errors unless LOG_CONSOLE says otherwise. + let console_filter = + EnvFilter::try_from_env("LOG_CONSOLE").unwrap_or_else(|_| EnvFilter::new("warn")); + tracing_subscriber::registry() .with(env_filter) - .with(fmt_layer) + .with(fmt_layer.with_filter(console_filter)) .with(otel_trace_layer) .with(otel_log_layer.with_filter(otel_filter)) .init(); -- 2.54.1