[Pdns-users] structured logging [was: First Alpha Release of PowerDNS Recursor 4.8.0]

Otto Moerbeek otto at drijf.net
Fri Sep 23 11:31:38 UTC 2022

On Fri, Sep 23, 2022 at 12:48:06PM +0200, Jan-Piet Mens via Pdns-users wrote:

> >     * [1]Structured Logging has been implemented for almost all
> >       subsystems. This allows for improved (automated) analysis of
> >       logging information.
> Is there any further documentation about this other than the link you added and the "Logging" [2] section in the documentation?
> What exactly does "structured" mean? Is this JSON? Are there any examples?
> 	-JP
> [2] https://docs.powerdns.com/recursor/running.html#logging

It means the information is deliverd as key-value pairs instead of
free-format strings.  The default bakcend sends this as formatting
strings with proper quoting rules to the existing logging system
(either systemd-journal in text mode or syslog). In that case, it
looks like this:

Sep 23 13:21:50 msg="trying DoT" subsystem="taskq" level="0"
prio="Warning" tid="6" ts="1663932110.773" ip=""
method="tryDoT" name="powerdns.com" qtype="SOA"

This allows alreayd for more robust log line scanning.

When configured, the information can also be sent to journald using
"native" format. In that case, tye key-value pairs are stored in a log
database by journald and journalctl can be used to convert it to e.g.
json, allowing further automated processing.

In the future we might implement other backends, e.g. to other sytem
that like to store key-value pairs.

Hope this helps.


More information about the Pdns-users mailing list