From: Pieter Lexis Date: Tue, 7 Jul 2026 12:06:08 +0000 (+0200) Subject: feat(dnsdist): Log TraceID in structured logs X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=04665f0526787d7c0fef3eab2ccfc30bfcd2b34d;p=thirdparty%2Fpdns.git feat(dnsdist): Log TraceID in structured logs When a traced query generates a log message, log the TraceID as well fo easier correlation. --- diff --git a/pdns/dnsdistdist/dnsdist-idstate.cc b/pdns/dnsdistdist/dnsdist-idstate.cc index 63cac9b8b6..9844de0db4 100644 --- a/pdns/dnsdistdist/dnsdist-idstate.cc +++ b/pdns/dnsdistdist/dnsdist-idstate.cc @@ -163,5 +163,10 @@ std::shared_ptr InternalQueryState::getLogger(std::shared_pt parent = dnsdist::logging::getTopLogger("query-processing"); } auto logger = parent->withValues("dns.question.name", Logging::Loggable(this->qname), "dns.question.type", Logging::Loggable(this->qtype), "dns.question.class", Logging::Loggable(this->qclass), "source.address", Logging::Loggable(this->origRemote), "destination.address", Logging::Loggable(this->origDest), "proto", Logging::Loggable(this->protocol), "dns.question.id", Logging::Loggable(ntohs(this->origID)), "dns.question.flags", Logging::Loggable(this->origFlags)); +#ifndef DISABLE_PROTOBUF + if (d_OTTracer != nullptr) { + logger = logger->withValues("traceID", Logging::Loggable{d_OTTracer->getTraceID().toLogString()}); + } +#endif return logger; }