From: Remi Gacogne Date: Tue, 21 Nov 2023 16:16:53 +0000 (+0100) Subject: dnsdist: Use 'ts', not 'tm', for the timestamp in structured-like log messages X-Git-Tag: rec-5.0.0-rc1~20^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=992ba79f7596e8e6c06f9b7f2c0e73dafe4742cf;p=thirdparty%2Fpdns.git dnsdist: Use 'ts', not 'tm', for the timestamp in structured-like log messages --- diff --git a/pdns/dnsdistdist/docs/reference/config.rst b/pdns/dnsdistdist/docs/reference/config.rst index efe3d9d551..44e7d8dd93 100644 --- a/pdns/dnsdistdist/docs/reference/config.rst +++ b/pdns/dnsdistdist/docs/reference/config.rst @@ -1210,11 +1210,11 @@ Status, Statistics and More Set whether log messages should be in a structured-logging-like format. This is turned off by default. The resulting format looks like this (when timestamps are enabled via ``--log-timestamps`` and with ``levelPrefix="prio"`` and ``timeFormat="ISO8601"``):: - tm="2023-11-06T12:04:58+0100" prio="info" msg="Added downstream server 127.0.0.1:53" + ts="2023-11-06T12:04:58+0100" prio="Info" msg="Added downstream server 127.0.0.1:53" And with ``levelPrefix="level"`` and ``timeFormat="numeric"``):: - tm="1699268815.133" level="info" msg="Added downstream server 127.0.0.1:53" + ts="1699268815.133" level="Info" msg="Added downstream server 127.0.0.1:53" :param bool enable: Set to true if you want to enable structured logging :param table options: A table with key: value pairs with options described below. diff --git a/pdns/dnsdistdist/dolog.cc b/pdns/dnsdistdist/dolog.cc index 0222e14b56..318145b732 100644 --- a/pdns/dnsdistdist/dolog.cc +++ b/pdns/dnsdistdist/dolog.cc @@ -86,7 +86,7 @@ void logTime(std::ostream& stream) } if (dnsdist::logging::LoggingConfiguration::getStructuredLogging()) { - stream << "tm=\"" << buffer.data() << "\" "; + stream << "ts=" << std::quoted(buffer.data()) << " "; } else { stream << buffer.data();