This patch fixes integration with systemd-journald, and also sets the
now mandatory KillMode.
When running on systems with systemd-journald certain considerations
must be taken. These are listed here:
https://www.freedesktop.org/wiki/Software/systemd/syslog/
In it simplest form, the system as a whole logs through journald and
a BSD syslog daemon then gets its log messages from journald.
NOTE: due to issues with the Debian packaging of rsyslog, the sysklogd
packages cannot be used to replace rsyslog. First rsyslog must
be purged to clear the syslog.socket symlink, then sysklogd can
be installed.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
When syncing with the FreeBSD man page the audit missed this option.
The man page should detail what the daemon does, even though in this
case it would've been nice to have the FreeBSD behahvior for -v.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
It is well established practise on Linux to use /dev/kmsg (old or
new API) before syslogd is up (and /dev/log exists). This patch
enables support for extracting non-kernel log messages and logging
them with their proper facility and priority.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This patch adds support for logging to /dev/kmsg, which can be highly
useful for early scripts that run long before syslogd has started and
/dev/log is available.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Coverity found two possible untrusted loop bounds, in unix_cb() and
inet_cb(), that were indeed possibly unterminated strings. These
were classified as medium. A third finding, marked high, was found
in kernel_cb(), which upon further investigation seems bogus.
This patch terminates the buffers received in unix_cb() and inet_cb()
but only changes to 0 from \0 termination in kernel_cb().
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Although hihgly unlikely, if the kernel log sequence number (seqno)
reaches the end of its MAX value (18446744073709551615) we allow for
dupes to handle the wrap-around back to zero (0) in the counter.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This patch fixes the problem with kernel messages being repeated when
syslogd is restarted at runtime. This is achieved by caching the last
seqno read from /dev/kmsg to /run/syslogd.cache. The latter is usually
a ram disk these days so it should be a fairly quick op.
Excessive updates are prevented by only caching after handling all
callbacks in the socket_poll() loop, and only updating the cache
if there has been any new kernel messages since last update.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
The timer_now() API, introduced in 2019, returns time relative to boot.
Useful for relative time comparisons, but when used for absolute time,
e.g. for log messages, it must be offset with boot_time.
This patch fixes issue #28, but also wall messages, which exhibits the
same problem.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
- drop hard-coded -s from syslogd command line
- allow options to be read from /etc/default/syslogd
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This should fix any lingering issues with logging with the wrong
timezone at boot. As long as syslogd gets HUP'ed after setting
the new timezone.
Improvements to this welcome, of course.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>