Structured logging dictionary¶
This page describes the common entries of the Structured Logging component. Currently these backends are supported:
The
defaulttext based backendThe
systemd-journalbackendThe
jsonbackend
The default backend¶
The default backend uses a text representation of the key-value pairs.
A line is constructed by appending all key-value pairs as key="value", separated by spaces.
The output is written by passing the resulting text line to the standard error stream and also to syslog if --disable-syslog was not passed on the command-line.
An example line looks like this:
msg="Raised send buffer size" subsystem="setup" level="0" prio="Info" ts="2025-12-29T17:16:17+0100" frontend.address="127.0.0.1:8053" network.send_buffer_size="4194304
Key names are not quoted.
Values are quoted with double quotes.
If a value contains a double quote, it is escaped with a backslash.
Backslashes in the value are escaped by prepending a backslash.
The following keys are always present:
Key |
Type |
Example |
Remarks |
|
|
|
Value is the same for all instances of
this log entry, together with
|
|
|
|
Uniquely identifies the log
entry together with the value of
|
|
|
|
The detail level of the log entry. Not actively used currently. |
|
|
|
One of |
|
|
|
Number of seconds since the Unix epoch, including fractional part. |
A log entry can also have zero or more additional key-value pairs. We tried to adhere to OpenTelemetry’s general attributes when possible, or more specific ones like for example dns attributes or http attributes for DNS over HTTPS.
Common keys are:
Key |
Type |
Example |
Remarks |
|
|
|
An error cause. |
|
|
|
An IP: port combination. |
|
|
|
A list of subnets, space separated. |
|
|
|
Address of the DNS client. |
|
|
|
Address of the downstream backend. |
|
|
|
Name of the downstream backend, if any. |
|
|
|
Protocol used to send DNS queries to the downstream backend. |
|
|
|
Destination address of a packet (may be more specific than |
|
|
|
The DNS query class. |
|
|
|
The DNS query ID. |
|
|
|
The DNS query name. |
|
|
|
The time this query was received, as the number of seconds since EPOCH. |
|
|
|
Additional nano-seconds for |
|
|
|
Size of the DNS query packet, in bytes. |
|
|
|
The DNS query type. |
|
|
|
The DNS response class. |
|
|
|
The DNS response ID. |
|
|
|
The latency between the query and the response, in microseconds. |
|
|
|
The DNS response name. |
|
|
|
DNS response code |
|
|
|
Size of the DNS response packet, in bytes. |
|
|
|
The DNS response type. |
|
|
|
Address this frontend is listening on. |
|
|
|
Protocol this frontend is accepting DNS queries over. |
|
|
|
HTTP/2 query method for DoH. |
|
|
|
HTTP/2 query path for DoH. |
|
|
|
HTTP/2 response code for DoH. |
|
|
|
HTTP/2 stream identifier for DoH. |
|
|
|
Local address and port DNSdist is listening on (webserver, console, …). |
|
|
|
Peer address of the network connection (may differ from |
|
|
|
|
|
|
|
Downstream backends pool name. |
|
|
|
The systemd-journal backend¶
The systemd-journal structured logging backend uses mostly the same keys and values as the default backend, with the exceptions:
keys are capitalized as required for
systemd-journal.msgis translated toMESSAGE.priois translated toPRIORITY.tsis translated toTIMESTAMP.If the original key is in a list of keys special to
systemd-journal, it is capitalized and prepended byPDNS_. The list of special keys is: message, message_id, priority, code_file, code_line, code_func, errno, invocation_id, user_invocation_id, syslog_facility, syslog_identifier, syslog_pid, syslog_timestamp, syslog_raw, documentation, tid, unit, user_unit, object_pid.
To use this logging backend, add the --structured-logging-backend systemd-journal to the command line in the systemd unit file.
To query the log, use a command similar to:
# journalctl -r -n 1 -o json-pretty -u dnsdist.service
The json backend¶
The json structured logging backend uses the same keys and values as the default backend.
An example of a log object:
{"level": "0", "msg": "Adding TCP worker thread to handle TCP connections from clients", "priority": "6", "ts": "2025-12-29T17:20:20+0100"}
All values are represented as strings.
The JSON log objects are written to the standard error stream.