Matthew Pounsett wrote:
Hi!
I have two Debian 10 Buster systems, both patched up current, and both
running Knot 3.0.4-1~cz.nic~buster1 from the apt repository at
https://deb.knot-dns.cz/knot-latest/.
Both Knot installations have virtually identical configs .. really
only different in the related hosts and zone lists. Their logging
configs are both:
log:
- target: syslog
any: info
One of these Knot instances logs to syslog, and the other logs to
systemd-journald. I'm trying to figure out why the difference, and
I've come up empty. The Knot docs simply say that if Knot is compiled
against systemd, then a 'syslog' setting will use systemd-journald.
Mostly I want to know so that I can convince the one using journald to
stop doing that. :) What other things might trigger Knot to use
syslog on a systemd-managed host?
If I'm reading the knot source code correctly [0,1], knotd
unconditionally logs to the system journal interface if knotd has been
compiled with systemd support and the system is running with systemd as
PID 1. So, a better question might be why knot is using syslog at all on
one of your hosts.
On your system where you're getting knotd log output into syslog, is
knotd is actually sending the log output to a syslog daemon, or is it
sending the log output to the system journal, and systemd-journald is
forwarding it to a syslog daemon?
On Debian 10 systems, systemd-journald listens on both the system
journal sockets as well as the traditional syslog socket at /dev/log,
and systemd-journald defaults to ForwardToSyslog=yes which causes log
messages to be forwarded to a traditional syslog daemon if one is
installed. The only thing you should need to do to get log messages
dumped into the traditional text files under /var/log should be to
install a syslog daemon package like rsyslog if one isn't already
installed.
[0] log_init():
https://gitlab.nic.cz/knot/knot-dns/-/blob/v3.0.4/src/knot/common/log.c#L15…
[1] emit_log_msg():
https://gitlab.nic.cz/knot/knot-dns/-/blob/v3.0.4/src/knot/common/log.c#L21…
--
Robert Edmonds
edmonds(a)debian.org