Git Product home page Git Product logo

sysklogd's Introduction

                  .--.  .--.              .--.
.-----.--.--.-----|  |--|  :-----.-----.--|  |
|__ --|  |  |__ --|    <|  |  _  |  _  |  _  |    RFC3164 :: syslogd for Linux
|_____|___  |_____|__|__|__|_____|___  |_____|    RFC5424 :: w/NetBSD syslogp()
      |_____|                    |_____|

<23>Aug 24 05:14:15 192.0.2.1 myproc[8710]: Kilroy was here.
<23>1 2019-11-04T00:50:15.001234+01:00 troglobit myproc 8710 - - Kilroy was here.

BSD Badge GitHub Status Coverity Status

Table of Contents

Tip: the Gentoo project has a very nice article detailing sysklogd ➤ https://wiki.gentoo.org/wiki/Sysklogd

Introduction

This is the continuation of the original Debian/Ubuntu syslog daemon, updated with full RFC3164 and RFC5424 support from NetBSD and FreeBSD. The package includes the libsyslog.{a,so} library with a syslog.h header replacement, the syslogd daemon, and a command line tool called logger.

libsyslog and syslog/syslog.h, derived directly from NetBSD, expose syslogp() and other new features available only in RFC5424:

The syslogd daemon is an enhanced version of the standard Berkeley utility program, updated with DNA from FreeBSD. It provides logging of messages received from the kernel, programs and facilities on the local host as well as messages from remote hosts. Although fully compatible with standard C-library implementations of the syslog() API (GLIBC, musl libc, uClibc), libsyslog must be used in your application to unlock the new RFC5424 syslogp() API.

The included logger tool is primarily made for use with sysklogd, but can be used stand-alone too. It is not command line compatible with the "standard" Linux logger tool from the bsdutils project. Instead it is compatible with the actual BSD logger tool(s) -- only major difference is its support for -I PID, similar to the bsdutils --id=PID. The logger tool can be used from the command line, or script, to send both RFC5424 (default) and old-style (BSD) RFC3164 formatted messages using libsyslog to syslogd for local processing, or to a remote server.

Main differences from the original sysklogd package are:

  • The separate klogd daemon is no longer part of the sysklogd project, syslogd now natively supports logging kernel messages as well
  • Major command line changes to syslogd, for compatibilty with *BSD
  • Supports include /etc/syslog.d/*.conf directive, see example .conf
  • Built-in log-rotation support, with compression by default, useful for embedded systems. No need for cron and/or a separate log rotate daemon
  • Full RFC3164 and RFC5424 support from NetBSD and FreeBSD
  • Support for sending RFC3164 style remote syslog messages, including timestamp and hostname. Defaults to send w/o for compatibility
  • Support for sending RFC5424 style remote syslog messages
  • Support for sending messages to a custom port on a remote server
  • Support for listening to a custom port
  • Support for remote peer filtering, from FreeBSD
  • Support for disabling DNS reverse lookups for each remote log message
  • Support for FreeBSD Secure Mode, remote logging enabled by default(!)
  • Includes a fit for purpose logger tool, compatible with syslogd, leveraging the full RFC5424 capabilities (msgid etc.)
  • Includes a syslog library and system header replacement for logging
  • FreeBSD socket receive buffer size patch
  • Avoid blocking syslogd if console is backed up
  • Touch PID file on SIGHUP, for integration with Finit
  • GNU configure & build system to ease porting/cross-compiling
  • Support for configuring remote syslog timeout

Please file bug reports, or send pull requests for bug fixes and/or proposed extensions at GitHub.

Using -lsyslog

libsyslog is by default installed as a library with a header file:

#include <syslog/syslog.h>

The output from the pkg-config tool holds no surprises:

$ pkg-config --libs --static --cflags libsyslog
-I/usr/local/include -L/usr/local/lib -lsyslog

The prefix path /usr/local/ shown here is only the default. Use the configure script to select a different prefix when installing libsyslog.

For GNU autotools based projects, instead of issuing the pkg-config command manually, use the following in configure.ac:

# Check for required libraries
PKG_CHECK_MODULES([syslog], [libsyslog >= 2.0])

and for your "proggy" in Makefile.am:

proggy_CFLAGS = $(syslog_CFLAGS)
proggy_LDADD  = $(syslog_LIBS)

The distribution comes with an example program that utilizes the NetBSD API and links against libsyslog.

Build & Install

The GNU Configure & Build system use /usr/local as the default install prefix. In many cases this is useful, but this means the configuration files and cache files will also use that same prefix. Most users have come to expect those files in /etc/ and /var/run/ and configure has a few useful options that are recommended to use:

./configure --prefix=/usr --sysconfdir=/etc --runstatedir=/run
make -j5
sudo make install-strip

You may want to remove the --prefix=/usr option. Most users prefer non-distro binaries in /usr/local or /opt.

Note: the --runstatedir option should point to a filesystem that is cleaned at reboot. syslogd relies on this for its syslogd.cache file, which keeps track of the last read kernel log message from /dev/kmsg.

Building from GIT

If you want to contribute, or just try out the latest but unreleased features, then you need to know a few things about the GNU build system:

  • configure.ac and a per-directory Makefile.am are key files
  • configure and Makefile.in are generated from autogen.sh, they are not stored in GIT but automatically generated for the release tarballs
  • Makefile is generated by configure script

To build from GIT you first need to clone the repository and run the autogen.sh script. This requires automake and autoconf to be installed on your system.

git clone https://github.com/troglobit/sysklogd.git
cd sysklogd/
./autogen.sh
./configure && make

GIT sources are a moving target and are not recommended for production systems, unless you know what you are doing!

Note: some systems may have an older, or a vanilla, version of the GNU autoconf package that does not support --runstatedir (above). Users on such systems are recommended to use --localstatedir, the $runstatedir used by sysklogd is derived from that if missing.

Origin & References

This is the continuation of the original sysklogd by Dr. G.W. Wettstein and Martin Schulze. Currently maintained, and almost completely rewritten by Joachim Wiberg, who spliced in fresh DNA strands from the NetBSD and FreeBSD projects. Much of the code base is NetBSD, but the command line interface is FreeBSD.

Note: the project name remains sysklogd, which was a combination of the names of the two main daemons, syslogd and klogd. However, since v2.0 klogd no longer exists, kernel logging is now native to syslogd.

The project was previously licensed under the GNU GPL, but since the removal of klogd, man pages, and resync with the BSDs the project is now 3-clause BSD licensed.

sysklogd's People

Contributors

anjiahao1 avatar askerin avatar douzzer avatar jchax avatar joeyschulze avatar kraj avatar loebl avatar mancha1 avatar meta-ed avatar pj1031999 avatar sandy-lcq avatar sdaoden avatar troglobit avatar zlamas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

sysklogd's Issues

RFE: `strftime(3)`-like format specifiers in log file name

Please add support for strftime(3)-like format specifiers in log file name so one can use templates like /var/log/messages-%F in /etc/syslog.conf and doesn't have to use logrotate(3) (except corner cases, e.g. /var/log/wtmp at least).

Beyond the scope of this issue and for discussion, syslogd might eventually support non-date/time related specifiers like host name.

(Based on cronolog recommendation by user "colo" on channel #openwrt at OFTC IRC network.)

Add option to always trust kernel timestamp, even after suspend/resume

In 9f6fbb3 a workaround for crazy out-of-sync kernel timestamps was added. The support is unconditional, meaning as soon as syslogd has started up and emptied the kernel ring buffer, it goes into a new mode of operation where kernel timestamps are ignored and the current time is used instead.

This behavior may not be what most user expect, so an advanced option to disable this behavior could be useful.

syslogd: kernel messages are always duplicated to console

If we run syslogd standalone without klogd all kernel messages appears on a tty console too. This does not happen if we run syslogd together with klogd. This is very annoying if you start the system without a graphical login manager, because system startup messages are mixed up with kernel messages.

How to reproduce:
start syslogd and switch to a text console, trigger a kernel message

System: CRUX linux

Thanks.

logging to remote machine stops after receiving a few SIGHUPs

Background

Log rotation using an external tool generally involves two steps. (1) rename the existing logs; (2) send SIGHUP to syslogd to create the new logs. For example, Slackware 15.0 has this logrotate(8) script:

/var/log/cron /var/log/debug /var/log/maillog /var/log/messages /var/log/secure /var/log/spooler /var/log/syslog {
    sharedscripts
    missingok
    postrotate
        /bin/kill -HUP `cat /var/run/syslogd.pid 2>/dev/null` 2>/dev/null || true
    endscript
}

Problem report

After several iterations of log rotation using SIGHUP, peers created using the @ symbol in syslog.conf stop receiving messages. Here is the example of such a peer that I used to reproduce the problem:

*.*                                                     @200.200.200.104        ;RFC3164

The communication failure is associated with frequent diagnostic messages logged by syslogd itself. Here is a log extract. (Please note these messages are pulled from /var/log/syslog and /var/log/messages and sorted by timestamp so might not be in exactly the correct order.)

Jul 17 04:40:01 slack syslogd[756]: INET sendto(200.200.200.104:syslog): Success
Jul 17 04:40:01 slack syslogd[756]: Only 16 IP addresses per socket supported.
Jul 17 04:40:01 slack syslogd[756]: syslogd v2.4.0: restart.
Jul 17 04:43:01 slack syslogd[756]: INET sendto(200.200.200.104:syslog): Success
Jul 17 04:43:01 slack syslogd[756]: Successfully resolved '200.200.200.104:syslog', initiating forwarding.
Jul 17 04:46:00 slack syslogd[756]: INET sendto(200.200.200.104:syslog): Success
Jul 17 04:46:00 slack syslogd[756]: Successfully resolved '200.200.200.104:syslog', initiating forwarding.
Jul 17 04:49:14 slack syslogd[756]: INET sendto(200.200.200.104:syslog): Success
Jul 17 04:49:14 slack syslogd[756]: Successfully resolved '200.200.200.104:syslog', initiating forwarding.
Jul 17 04:52:17 slack syslogd[756]: INET sendto(200.200.200.104:syslog): Success
Jul 17 04:52:17 slack syslogd[756]: Successfully resolved '200.200.200.104:syslog', initiating forwarding.
Jul 17 04:55:23 slack syslogd[756]: INET sendto(200.200.200.104:syslog): Success
Jul 17 04:55:23 slack syslogd[756]: Successfully resolved '200.200.200.104:syslog', initiating forwarding.
Jul 17 04:58:24 slack syslogd[756]: INET sendto(200.200.200.104:syslog): Success
Jul 17 04:58:24 slack syslogd[756]: Successfully resolved '200.200.200.104:syslog', initiating forwarding.
Jul 17 05:01:25 slack syslogd[756]: INET sendto(200.200.200.104:syslog): Success
Jul 17 05:01:25 slack syslogd[756]: Successfully resolved '200.200.200.104:syslog', initiating forwarding.
Jul 17 05:04:25 slack syslogd[756]: INET sendto(200.200.200.104:syslog): Success
Jul 17 05:04:25 slack syslogd[756]: Successfully resolved '200.200.200.104:syslog', initiating forwarding.
Jul 17 05:07:25 slack syslogd[756]: INET sendto(200.200.200.104:syslog): Success
Jul 17 05:07:25 slack syslogd[756]: Successfully resolved '200.200.200.104:syslog', initiating forwarding.

Possible root cause/resolution

Looking at the source to syslogd.c, the problem may be in init() which, when SIGHUP is received, closes all inet sockets but does not reset the socket count to 0, then reopens the sockets. So the pe_sock table fills up a little more after each SIGHUP until finally it is full and the socket cannot be reopened:

	SIMPLEQ_FOREACH(pe, &pqueue, pe_link) {
		if (pe->pe_name && pe->pe_name[0] == '/') {
			create_unix_socket(pe);
		} else {
			for (size_t i = 0; i < pe->pe_socknum; i++)
				socket_close(pe->pe_sock[i]);

			if (SecureMode < 2)
				create_inet_socket(pe);
		}
	}

If this is correct, the solution might be to add a line after the for loop:

                        pe->pe_socknum = 0;

Please, can someone having more familiarity with the socket management in syslogd.c review this bug report and let me know if there is more to it than this. After the review I will write the patch.

O_CLOEXEC not available on all systems

I was updating sysklogd in buildroot.

buildroot maintainer Thomas Petazzoni sent me a notice that sysklogd 2.1.2 will not build under some circumstances, because some build environments are lacking the definition of O_CLOEXEC (see http://lists.busybox.net/pipermail/buildroot/2020-December/297937.html).

This could be solved by either defining O_CLOEXEC if not defined or using close_on_exec_on.
Another way could be defining _GNU_SOURCE in CFLAGS or in code before including fcntl.h.
I just now saw you already defined _GNU_SOURCE in lib/pidfile.c, so maybe extend this so it is used in src/syslog.c. src/syslogd.c too.

To reproduce the issue with buildroot:
Get buildroot
Apply patch from http://lists.busybox.net/pipermail/buildroot/2020-August/289056.html
Use the defconfig mentioned by Thomas

-v option doesn't work as described in the man-page

syslogd(8) says that the -v option enables verbose logging. That doesn't work:

# /usr/sbin/syslogd -v
syslogd v2.2.3
# pgrep syslogd

syslogd prints the version string but doesn't start.
Tested with both, 2.2.2 and 2.2.3

Logging of non-ASCII characters

Hi,

I'm not sure if this is actually a sysklogd issue, but I have to start somewhere, I guess. 🤷‍♂️ Short context: the recently released Slackware 15.0 comes with your sysklogd-2.3.0, while previous versions of Slackware (14.2 and lower) included the old infodrom.org sysklogd-1.5.1 that you forked off a while ago.

Now it looks like the logging of (the greater portion of) non-ASCII characters appears to be broken. I found a line in my logs which (when viewed with less, and $LESSCHARSET="utf-8") looks like this (please scroll right to the end of the line) ...

Feb 21 21:54:15 next gcr-prompter[2368]: GLib-GIO: _g_io_module_get_default: Found default implementation gvfs (GDaemonVfs) for <E2>M-^@M-^Xgio-vfs<E2>M-^@M-^Y

... while it is actually supposed to look like this (again, please scroll right to the end of the line):

Feb 21 21:54:15 next gcr-prompter[2368]: GLib-GIO: _g_io_module_get_default: Found default implementation gvfs (GDaemonVfs) for ‘gio-vfs’

After quite a bit of head scratching, some debugging, and building of a couple of sysklogd's released versions on Slackware 15.0, I came to the conclusion that 1.6 is the last version that logs non-ASCII characters properly. As of 2.0, which I understand was more or less almost a rewrite from scratch, non-ASCII characters turn up garbled in the on-disk logs.

This is with sysklogd-2.0 and later ... on one terminal:

[root@next:/usr/src/slackware/a]# /usr/sbin/syslogd -s -d
Starting.
nslookup 'none:syslog'
Created inet socket 4 for (null):syslog ...
Created inet socket 5 for (null):syslog ...
Created UNIX socket 6 ...
cfline(*.info;*.!warn;authpriv.none;cron.none;mail.none;news.none	-/var/log/messages)
symbolic name: info ==> 6
symbolic name: warn ==> 4
symbolic name: none ==> 16
symbolic name: authpriv ==> 80
symbolic name: none ==> 16
symbolic name: cron ==> 72
symbolic name: none ==> 16
symbolic name: mail ==> 16
symbolic name: none ==> 16
symbolic name: news ==> 56
leading char in action: /
filename: '/var/log/messages'
RFC3164 format enabled
cfline(*.warn;authpriv.none;cron.none;mail.none;news.none	-/var/log/syslog)
symbolic name: warn ==> 4
symbolic name: none ==> 16
symbolic name: authpriv ==> 80
symbolic name: none ==> 16
symbolic name: cron ==> 72
symbolic name: none ==> 16
symbolic name: mail ==> 16
symbolic name: none ==> 16
symbolic name: news ==> 56
leading char in action: /
filename: '/var/log/syslog'
RFC3164 format enabled
cfline(*.=debug						-/var/log/debug)
symbolic name: debug ==> 7
leading char in action: /
filename: '/var/log/debug'
RFC3164 format enabled
cfline(authpriv.*						-/var/log/secure)
symbolic name: * ==> 255
symbolic name: authpriv ==> 80
leading char in action: /
filename: '/var/log/secure'
RFC3164 format enabled
cfline(cron.*							-/var/log/cron)
symbolic name: * ==> 255
symbolic name: cron ==> 72
leading char in action: /
filename: '/var/log/cron'
RFC3164 format enabled
cfline(mail.*							-/var/log/maillog)
symbolic name: * ==> 255
symbolic name: mail ==> 16
leading char in action: /
filename: '/var/log/maillog'
RFC3164 format enabled
cfline(*.emerg							*)
symbolic name: emerg ==> 0
leading char in action: *
write-all
RFC3164 format enabled
Searching for /etc/syslog.d/*.conf ...
Opening /etc/syslog.d/dev-tty12.conf ...
Parsing /etc/syslog.d/dev-tty12.conf ...cfline(*.*	/dev/tty12)
symbolic name: * ==> 255
leading char in action: /
filename: '/dev/tty12'
RFC3164 format enabled
60 60  X 60 60 60 60  X 60  X  X 60 60 60 60 60 60 60 60 60 60 60 60 60 60 FILE: /var/log/messages
1F 1F  X 1F 1F 1F 1F  X 1F  X  X 1F 1F 1F 1F 1F 1F 1F 1F 1F 1F 1F 1F 1F 1F FILE: /var/log/syslog
80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 FILE: /var/log/debug
 X  X  X  X  X  X  X  X  X  X FF  X  X  X  X  X  X  X  X  X  X  X  X  X  X FILE: /var/log/secure
 X  X  X  X  X  X  X  X  X FF  X  X  X  X  X  X  X  X  X  X  X  X  X  X  X FILE: /var/log/cron
 X  X FF  X  X  X  X  X  X  X  X  X  X  X  X  X  X  X  X  X  X  X  X  X  X FILE: /var/log/maillog
 1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1 WALL: 
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF TTY: /dev/tty12
syslogd v2.0: restart.
logmsg: syslog.info<46>, flags 0, from next, app-name syslogd procid 23020 msgid (null) sd (null) msg syslogd v2.0: restart.
Called fprintlog_first(), fmt3164(46, 0x00, next, syslogd, 23020, (null), (null), syslogd v2.0: restart.)logging to FILE /var/log/messages
Called fprintlog_first(), fmt3164(46, 0x00, next, syslogd, 23020, (null), (null), syslogd v2.0: restart.)logging to TTY /dev/tty12
syslogd: restarted.
Debugging disabled, SIGUSR1 to turn on debugging.
Message from UNIX socket #6: <15>1 2022-02-22T12:40:33.145243+01:00 next test - - - iso/latin - öäüÖÄÜ߀¢§ 
logmsg: user.debug<15>, flags 0, from next, app-name test procid (null) msgid (null) sd (null) msg iso/latin - öäü�M-^V�M-^D�M-^\�M-^_�M-^B�¢§ 
Called fprintlog_first(), fmt3164(15, 0x00, next, test, (null), (null), (null), iso/latin - öäü�M-^V�M-^D�M-^\�M-^_�M-^B�¢§ )logging to FILE /var/log/debug
Called fprintlog_first(), fmt3164(15, 0x00, next, test, (null), (null), (null), iso/latin - öäü�M-^V�M-^D�M-^\�M-^_�M-^B�¢§ )logging to TTY /dev/tty12
Message from UNIX socket #6: <15>1 2022-02-22T12:40:33.149393+01:00 next test - - - unicode - –…‘’• 
logmsg: user.debug<15>, flags 0, from next, app-name test procid (null) msgid (null) sd (null) msg unicode - �M-^@M-^S�M-^@��M-^@M-^X�M-^@M-^Y�M-^@� 
Called fprintlog_first(), fmt3164(15, 0x00, next, test, (null), (null), (null), unicode - �M-^@M-^S�M-^@��M-^@M-^X�M-^@M-^Y�M-^@� )logging to FILE /var/log/debug
Called fprintlog_first(), fmt3164(15, 0x00, next, test, (null), (null), (null), unicode - �M-^@M-^S�M-^@��M-^@M-^X�M-^@M-^Y�M-^@� )logging to TTY /dev/tty12
[...]

And meanwhile, on a terminal not far away:

[root@next:~]# pkill -USR1 syslogd
[root@next:~]# date; logger.sysklogd -p debug -s -t test "iso/latin - öäüÖÄÜ߀¢§"; logger.sysklogd -p debug -s -t test "unicode - –…‘’•"; tail -2 /var/log/debug
Di 22 Feb 2022 12:40:33 CET
Feb 22 2022 12:40:33 test: iso/latin - öäüÖÄÜ߀¢§ 
Feb 22 2022 12:40:33 test: unicode - –…‘’• 
Feb 22 12:40:33 next test: iso/latin - öäü�M-^V�M-^D�M-^\�M-^_�M-^B�¢§ 
Feb 22 12:40:33 next test: unicode - �M-^@M-^S�M-^@��M-^@M-^X�M-^@M-^Y�M-^@� 

Note the Message from UNIX socket lines in the debug output where the characters are still intact! This seems to suggest that syslogd is receiving all characters just fine, and they only get munched later on, somewhere on their way to disk.

And here's the same exercise with sysklogd-1.6, where everything works as expected. On one terminal:

[root@next:/usr/src/slackware/a]# /usr/sbin/syslogd -d
Allocated parts table for 1024 file descriptors.
Starting.
Called init.
Called allocate_log, nlogs = -1.
cfline(*.info;*.!warn;authpriv.none;cron.none;mail.none;news.none	-/var/log/messages)
symbolic name: info ==> 6
symbolic name: warn ==> 4
symbolic name: none ==> 16
symbolic name: authpriv ==> 80
symbolic name: none ==> 16
symbolic name: cron ==> 72
symbolic name: none ==> 16
symbolic name: mail ==> 16
symbolic name: none ==> 16
symbolic name: news ==> 56
leading char in action: /
filename: /var/log/messages
Called allocate_log, nlogs = 0.
cfline(*.warn;authpriv.none;cron.none;mail.none;news.none	-/var/log/syslog)
symbolic name: warn ==> 4
symbolic name: none ==> 16
symbolic name: authpriv ==> 80
symbolic name: none ==> 16
symbolic name: cron ==> 72
symbolic name: none ==> 16
symbolic name: mail ==> 16
symbolic name: none ==> 16
symbolic name: news ==> 56
leading char in action: /
filename: /var/log/syslog
Called allocate_log, nlogs = 1.
cfline(*.=debug						-/var/log/debug)
symbolic name: debug ==> 7
leading char in action: /
filename: /var/log/debug
Called allocate_log, nlogs = 2.
cfline(authpriv.*						-/var/log/secure)
symbolic name: * ==> 255
symbolic name: authpriv ==> 80
leading char in action: /
filename: /var/log/secure
Called allocate_log, nlogs = 3.
cfline(cron.*							-/var/log/cron)
symbolic name: * ==> 255
symbolic name: cron ==> 72
leading char in action: /
filename: /var/log/cron
Called allocate_log, nlogs = 4.
cfline(mail.*							-/var/log/maillog)
symbolic name: * ==> 255
symbolic name: mail ==> 16
leading char in action: /
filename: /var/log/maillog
Called allocate_log, nlogs = 5.
cfline(*.emerg							*)
symbolic name: emerg ==> 0
leading char in action: *
write-all
Called allocate_log, nlogs = 6.
cfline(include /etc/syslog.d/*.conf)
symbolic name: d/*.confCalled logerr, msg: unknown priority name "d/*.conf"
logmsg: syslog.err<43>, flags 4, from next, msg syslogd: unknown priority name "d/*.conf"
Called fprintlog, logging to CONSOLE /dev/console
Opened UNIX socket `/dev/log'.
 0: 60 60  X 60 60 60 60  X 60  X  X 60 60 60 60 60 60 60 60 60 60 60 60 60 60 FILE: /var/log/messages
 1: 1F 1F  X 1F 1F 1F 1F  X 1F  X  X 1F 1F 1F 1F 1F 1F 1F 1F 1F 1F 1F 1F 1F 1F FILE: /var/log/syslog
 2: 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 FILE: /var/log/debug
 3:  X  X  X  X  X  X  X  X  X  X FF  X  X  X  X  X  X  X  X  X  X  X  X  X  X FILE: /var/log/secure
 4:  X  X  X  X  X  X  X  X  X FF  X  X  X  X  X  X  X  X  X  X  X  X  X  X  X FILE: /var/log/cron
 5:  X  X FF  X  X  X  X  X  X  X  X  X  X  X  X  X  X  X  X  X  X  X  X  X  X FILE: /var/log/maillog
 6:  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1 WALL: 
logmsg: syslog.info<46>, flags 4, from next, msg syslogd v1.6: restart.
Called fprintlog, logging to FILE /var/log/messages
syslogd: restarted.
Debugging disabled, SIGUSR1 to turn on debugging.
Select interrupted.
Calling select, active file descriptors (max 3): 3 

Successful select, descriptor count = 1, Activity on: 3 
Message from UNIX socket: #3
Message length: 61, File descriptor: 3.
logmsg: user.debug<15>, flags 2, from next, msg Feb 22 12:22:07 test: iso/latin - öäüÖÄÜ߀¢§
Called fprintlog, logging to FILE /var/log/debug
Calling select, active file descriptors (max 3): 3 

Successful select, descriptor count = 1, Activity on: 3 
Message from UNIX socket: #3
Message length: 53, File descriptor: 3.
logmsg: user.debug<15>, flags 2, from next, msg Feb 22 12:22:07 test: unicode - –…‘’•
Called fprintlog, logging to FILE /var/log/debug
Calling select, active file descriptors (max 3): 3 
^Csyslogd: exiting on signal 2
logmsg: syslog.info<46>, flags 4, from next, msg exiting on signal 2
Called fprintlog, logging to FILE /var/log/messages

And from the second terminal:

[root@next:~]# pkill -USR1 syslogd
[root@next:~]# date; logger.util-linux -p debug -s -t test "iso/latin - öäüÖÄÜ߀¢§"; logger.util-linux -p debug -s -t test "unicode - –…‘’•"; tail -2 /var/log/debug
Di 22 Feb 2022 12:22:07 CET
<15>Feb 22 12:22:07 test: iso/latin - öäüÖÄÜ߀¢§
<15>Feb 22 12:22:07 test: unicode - –…‘’•
Feb 22 12:22:07 next test: iso/latin - öäüÖÄÜ߀¢§
Feb 22 12:22:07 next test: unicode - –…‘’•

All characters end up in the logs ungarbled. In case you're wondering, logger.sysklogd is the logger binary from sysklogd itself, while logger.util-linux is the one from - yes, you guessed it! 😉 - util-linux, because sysklogd-1.6 does not ship a logger binary itself.

Soooooooo ... TBH, I really have no idea if this is actually a bug, or if it's actually known, to be expected, wanted, needed, desired, or even required or mandated behaviour, either by some RFC, or some other standards I don't know about. I'll leave that up to you to decide. Thanks for putting up with my lengthy bug report! 👍

Static build failure of logger tool with gcc 11

The following static build failure is raised when building logger tool with gcc 11 because openlog, vsyslog, syslog, closelog and setlogmask are already defined in libc:

/home/autobuild/autobuild/instance-9/output-1/per-package/sysklogd/host/bin/../lib/gcc/m68k-buildroot-linux-uclibc/11.3.0/../../../../m68k-buildroot-linux-uclibc/bin/ld: /home/autobuild/autobuild/instance-9/output-1/per-package/sysklogd/host/m68k-buildroot-linux-uclibc/sysroot/usr/lib/libc.a(syslog.os): in function `openlog':
buildroot/build/uclibc-1.0.41/libc/misc/syslog/syslog.c:169: multiple definition of `openlog'; ./.libs/libsyslog.a(libsyslog_la-syslog.o):buildroot/build/sysklogd-2.4.0/src/syslog.c:141: first defined here
/home/autobuild/autobuild/instance-9/output-1/per-package/sysklogd/host/bin/../lib/gcc/m68k-buildroot-linux-uclibc/11.3.0/../../../../m68k-buildroot-linux-uclibc/bin/ld: /home/autobuild/autobuild/instance-9/output-1/per-package/sysklogd/host/m68k-buildroot-linux-uclibc/sysroot/usr/lib/libc.a(syslog.os): in function `__vsyslog':
buildroot/build/uclibc-1.0.41/libc/misc/syslog/syslog.c:196: multiple definition of `vsyslog'; ./.libs/libsyslog.a(libsyslog_la-syslog.o):buildroot/build/sysklogd-2.4.0/src/syslog.c:115: first defined here
/home/autobuild/autobuild/instance-9/output-1/per-package/sysklogd/host/bin/../lib/gcc/m68k-buildroot-linux-uclibc/11.3.0/../../../../m68k-buildroot-linux-uclibc/bin/ld: /home/autobuild/autobuild/instance-9/output-1/per-package/sysklogd/host/m68k-buildroot-linux-uclibc/sysroot/usr/lib/libc.a(syslog.os): in function `__GI_syslog':
buildroot/build/uclibc-1.0.41/libc/misc/syslog/syslog.c:329: multiple definition of `syslog'; ./.libs/libsyslog.a(libsyslog_la-syslog.o):buildroot/build/sysklogd-2.4.0/src/syslog.c:105: first defined here
/home/autobuild/autobuild/instance-9/output-1/per-package/sysklogd/host/bin/../lib/gcc/m68k-buildroot-linux-uclibc/11.3.0/../../../../m68k-buildroot-linux-uclibc/bin/ld: /home/autobuild/autobuild/instance-9/output-1/per-package/sysklogd/host/m68k-buildroot-linux-uclibc/sysroot/usr/lib/libc.a(syslog.os): in function `closelog':
buildroot/build/uclibc-1.0.41/libc/misc/syslog/syslog.c:343: multiple definition of `closelog'; ./.libs/libsyslog.a(libsyslog_la-syslog.o):buildroot/build/sysklogd-2.4.0/src/syslog.c:147: first defined here
/home/autobuild/autobuild/instance-9/output-1/per-package/sysklogd/host/bin/../lib/gcc/m68k-buildroot-linux-uclibc/11.3.0/../../../../m68k-buildroot-linux-uclibc/bin/ld: /home/autobuild/autobuild/instance-9/output-1/per-package/sysklogd/host/m68k-buildroot-linux-uclibc/sysroot/usr/lib/libc.a(syslog.os): in function `setlogmask':
buildroot/build/uclibc-1.0.41/libc/misc/syslog/syslog.c:351: multiple definition of `setlogmask'; ./.libs/libsyslog.a(libsyslog_la-syslog.o):buildroot/build/sysklogd-2.4.0/src/syslog.c:154: first defined here

There is several options:

  • rename those functions
  • disable static build of logger tool

Full build log: http://autobuild.buildroot.org/results/c88/c88b4401f2f367791a6feb296fff8f4178f4812b/build-end.log

Invalid time for kernel messages on 32-bit machines (x86)

Hi,

I've got a machine running 32 bit x86 Linux and was wondering why I was getting invalid times for logged kernel messages with sysklogd-2.2.2.
It appears that suseconds_t used in struct logtime which in turn is used in struct buf_msg is only 32 bit on my machine.
Unfortunately in printsys() in syslogd.c, buffer.timestamp.usec (of type suseconds_t) is used when interpreting how many microseconds the machine has been up and this will fail if the machine has been up for more than 2^31 us (=2147 sec) or 2^32 us (=4294 sec) depending on whether suseconds_t is signed (I haven't checked).
I think the interpretation of the kernel log line timestamp (microseconds since boot) needs to be done with a variable guaranteed to be 64bit e.g. uint64_t, something like:

void printsys(char msg)
{
struct buf_msg buffer;
char line[MAXLINE + 1];
uint64_t seqno = 0;
uint64_t ustime = 0; /
NEW VARIABLE */
char *lp, *p, *q;
int c;

    lp = line;
    for (p = msg; *p != '\0';) {
            memset(&buffer, 0, sizeof(buffer));
            buffer.app_name = "kernel";
            buffer.hostname = LocalHostName;
            buffer.pri = DEFSPRI;
            buffer.msg = line;

            if (*p == '<') {
                    /* /proc/klog or *BSD /dev/klog */
                    buffer.pri = 0;
                    while (isdigit(*++p))
                            buffer.pri = 10 * buffer.pri + (*p - '0');
                    if (*p == '>')
                            ++p;
            } else if (isdigit(*p)) {
                    /* Linux /dev/kmsg: "pri,seq#,msec,flag[,..];msg" */
                    time_t now = boot_time;

                    /* pri */
                    buffer.pri = 0;
                    while (isdigit(*p))
                            buffer.pri = 10 * buffer.pri + (*p++ - '0');

                    p++;          /* skip ',' */

                    /* seq# */
                    while (isdigit(*p))
                            seqno = 10 * seqno + (*p++ - '0');

                    p++;          /* skip ',' */

                    /* timestamp */
                    while (isdigit(*p))
                            ustime = 10 * ustime + (*p++ - '0');               /* UPDATED */
                    now += ustime / 1000000;                                     /* UPDATED */
                    buffer.timestamp.usec = ustime % 1000000;         /* UPDATED */
                    localtime_r(&now, &buffer.timestamp.tm);

(...)

Changes in the above marked with comments - sorry for not providing a diff but its only four lines of changes.

Testing suggests that the above changes fix the issue,

Best Regards,

Dale.

Add support for -c to disable "last message repeated"

Hello.
Is there a way to disable the "last repeated message" as old sysklogd did ?

-c Disable the repeating line compression that normally suppresses the repeated lines and logs a message such as 'last message repeated 124 times'. With this option, all repeated lines will be logged.

thanks !

klogd: bogus error message

At start of klogd I always get a bogus error message "Cannot find a map file." even though it seems that klogd finds my map file at /boot/system.map just fine.

Here's the debug output:

#> klogd -n -d -f /tmp/klogd.log
Logging line:
Line: klogd v%s, log source = %s started.
Priority: 6
Searching for symbol map.
Trying /boot/System.map-5.4.1.
Trying /boot/System.map.
Logging line:
Line: Inspecting %s
Priority: 6
No version information found.
Trying /System.map-5.4.1.
Trying /System.map.
Trying /usr/src/linux/System.map-5.4.1.
Trying /usr/src/linux/System.map.
End of search list encountered.
Logging line:
Line: Cannot find a map file.
Priority: 4
Cannot find a map file.
Loading kernel module symbols - Source: /proc/kallsyms
Logging line:
Line: Loaded %d %s from %d module%s
Priority: 6

and the content of /tmp/klogd.log:

#> cat /tmp/klogd.log
klogd v2.0.3, log source = /proc/kmsg started.
Inspecting /boot/System.map
Cannot find a map file.
Loaded 45119 symbols from 36 modules.

Thanks!

compile failed occasionally when do parallel build

I build sysklogd under yocto project, and compiled with "make -j 10"
and sometimes, compile failed with error:

DEBUG: Executing python function autotools_aclocals
DEBUG: SITE files ['endian-little', 'bit-64', 'arm-common', 'arm-64', 'common-linux', 'common-glibc', 'aarch64-linux', 'common']
DEBUG: Python function autotools_aclocals finished
DEBUG: Executing shell function do_compile
NOTE: make -j 10
make all-recursive
make[1]: Entering directory 'TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0/build'
Making all in example
make[2]: Entering directory 'TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0/build/example'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory 'TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0/build/example'
Making all in man
make[2]: Entering directory 'TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0/build/man'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory 'TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0/build/man'
Making all in src
make[2]: Entering directory 'TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0/build/src'
ccache aarch64-wrs-linux-gcc -march=armv8-a+crc -no-pie -fno-PIE --sysroot=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0/recipe-sysroot -DHAVE_CONFIG_H -I. -I../../git/src -I.. -DSYSCONFDIR="/etc" -DRUNSTATEDIR="/var/run" -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -W -Wall -Wextra -Wno-unused-result -Wno-unused-parameter -fno-strict-aliasing -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0=/usr/src/debug/sysklogd/2.0.3-r0 -fdebug-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0=/usr/src/debug/sysklogd/2.0.3-r0 -fdebug-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0/recipe-sysroot= -fdebug-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0/recipe-sysroot-native= -c -o syslogd-syslogd.o test -f 'syslogd.c' || echo '../../git/src/'syslogd.c
ccache aarch64-wrs-linux-gcc -march=armv8-a+crc -no-pie -fno-PIE --sysroot=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0/recipe-sysroot -DHAVE_CONFIG_H -I. -I../../git/src -I.. -DSYSCONFDIR="/etc" -DRUNSTATEDIR="/var/run" -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -W -Wall -Wextra -Wno-unused-result -Wno-unused-parameter -fno-strict-aliasing -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0=/usr/src/debug/sysklogd/2.0.3-r0 -fdebug-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0=/usr/src/debug/sysklogd/2.0.3-r0 -fdebug-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0/recipe-sysroot= -fdebug-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0/recipe-sysroot-native= -c -o syslogd-socket.o test -f 'socket.c' || echo '../../git/src/'socket.c
ccache aarch64-wrs-linux-gcc -march=armv8-a+crc -no-pie -fno-PIE --sysroot=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0/recipe-sysroot -DHAVE_CONFIG_H -I. -I../../git/src -I.. -DSYSCONFDIR="/etc" -DRUNSTATEDIR="/var/run" -D_BSD_SOURCE -D_DEFAULT_SOURCE -W -Wall -Wextra -Wno-unused-result -Wno-unused-parameter -fno-strict-aliasing -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0=/usr/src/debug/sysklogd/2.0.3-r0 -fdebug-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0=/usr/src/debug/sysklogd/2.0.3-r0 -fdebug-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0/recipe-sysroot= -fdebug-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0/recipe-sysroot-native= -c -o klogd-klogd.o test -f 'klogd.c' || echo '../../git/src/'klogd.c
ccache aarch64-wrs-linux-gcc -march=armv8-a+crc -no-pie -fno-PIE --sysroot=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0/recipe-sysroot -DHAVE_CONFIG_H -I. -I../../git/src -I.. -DSYSCONFDIR="/etc" -DRUNSTATEDIR="/var/run" -D_BSD_SOURCE -D_DEFAULT_SOURCE -W -Wall -Wextra -Wno-unused-result -Wno-unused-parameter -fno-strict-aliasing -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0=/usr/src/debug/sysklogd/2.0.3-r0 -fdebug-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0=/usr/src/debug/sysklogd/2.0.3-r0 -fdebug-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0/recipe-sysroot= -fdebug-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0/recipe-sysroot-native= -c -o klogd-ksym.o test -f 'ksym.c' || echo '../../git/src/'ksym.c
ccache aarch64-wrs-linux-gcc -march=armv8-a+crc -no-pie -fno-PIE --sysroot=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0/recipe-sysroot -DHAVE_CONFIG_H -I. -I../../git/src -I.. -DSYSCONFDIR="/etc" -DRUNSTATEDIR="/var/run" -D_BSD_SOURCE -D_DEFAULT_SOURCE -W -Wall -Wextra -Wno-unused-result -Wno-unused-parameter -fno-strict-aliasing -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0=/usr/src/debug/sysklogd/2.0.3-r0 -fdebug-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0=/usr/src/debug/sysklogd/2.0.3-r0 -fdebug-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0/recipe-sysroot= -fdebug-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0/recipe-sysroot-native= -c -o klogd-ksym_mod.o test -f 'ksym_mod.c' || echo '../../git/src/'ksym_mod.c
../aarch64-wrs-linux-libtool --tag=CC --mode=compile ccache aarch64-wrs-linux-gcc -march=armv8-a+crc -no-pie -fno-PIE --sysroot=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0/recipe-sysroot -DHAVE_CONFIG_H -I. -I../../git/src -I.. -DSYSCONFDIR="/etc" -DRUNSTATEDIR="/var/run" -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -W -Wall -Wextra -Wno-unused-result -Wno-unused-parameter -fno-strict-aliasing -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0=/usr/src/debug/sysklogd/2.0.3-r0 -fdebug-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0=/usr/src/debug/sysklogd/2.0.3-r0 -fdebug-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0/recipe-sysroot= -fdebug-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0/recipe-sysroot-native= -c -o libsyslog_la-syslog.lo test -f 'syslog.c' || echo '../../git/src/'syslog.c
ccache aarch64-wrs-linux-gcc -march=armv8-a+crc -no-pie -fno-PIE --sysroot=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0/recipe-sysroot -DHAVE_CONFIG_H -I. -I../../git/src -I.. -DSYSCONFDIR="/etc" -DRUNSTATEDIR="/var/run" -D_BSD_SOURCE -D_DEFAULT_SOURCE -W -Wall -Wextra -Wno-unused-result -Wno-unused-parameter -fno-strict-aliasing -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0=/usr/src/debug/sysklogd/2.0.3-r0 -fdebug-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0=/usr/src/debug/sysklogd/2.0.3-r0 -fdebug-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0/recipe-sysroot= -fdebug-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0/recipe-sysroot-native= -c -o ../lib/pidfile.o ../../git/src/../lib/pidfile.c
ccache aarch64-wrs-linux-gcc -march=armv8-a+crc -no-pie -fno-PIE --sysroot=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0/recipe-sysroot -DHAVE_CONFIG_H -I. -I../../git/src -I.. -DSYSCONFDIR="/etc" -DRUNSTATEDIR="/var/run" -D_BSD_SOURCE -D_DEFAULT_SOURCE -W -Wall -Wextra -Wno-unused-result -Wno-unused-parameter -fno-strict-aliasing -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0=/usr/src/debug/sysklogd/2.0.3-r0 -fdebug-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0=/usr/src/debug/sysklogd/2.0.3-r0 -fdebug-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0/recipe-sysroot= -fdebug-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0/recipe-sysroot-native= -c -o ../lib/strlcpy.o ../../git/src/../lib/strlcpy.c
ccache aarch64-wrs-linux-gcc -march=armv8-a+crc -no-pie -fno-PIE --sysroot=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0/recipe-sysroot -DHAVE_CONFIG_H -I. -I../../git/src -I.. -DSYSCONFDIR="/etc" -DRUNSTATEDIR="/var/run" -D_BSD_SOURCE -D_DEFAULT_SOURCE -W -Wall -Wextra -Wno-unused-result -Wno-unused-parameter -fno-strict-aliasing -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0=/usr/src/debug/sysklogd/2.0.3-r0 -fdebug-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0=/usr/src/debug/sysklogd/2.0.3-r0 -fdebug-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0/recipe-sysroot= -fdebug-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0/recipe-sysroot-native= -c -o ../lib/strlcat.o ../../git/src/../lib/strlcat.c
../aarch64-wrs-linux-libtool --tag=CC --mode=compile ccache aarch64-wrs-linux-gcc -march=armv8-a+crc -no-pie -fno-PIE --sysroot=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0/recipe-sysroot -DHAVE_CONFIG_H -I. -I../../git/src -I.. -DSYSCONFDIR="/etc" -DRUNSTATEDIR="/var/run" -D_BSD_SOURCE -D_DEFAULT_SOURCE -W -Wall -Wextra -Wno-unused-result -Wno-unused-parameter -fno-strict-aliasing -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0=/usr/src/debug/sysklogd/2.0.3-r0 -fdebug-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0=/usr/src/debug/sysklogd/2.0.3-r0 -fdebug-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0/recipe-sysroot= -fdebug-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0/recipe-sysroot-native= -c -o ../lib/strlcpy.lo ../../git/src/../lib/strlcpy.c
aarch64-wrs-linux-libtool: compile: ccache aarch64-wrs-linux-gcc -march=armv8-a+crc -no-pie -fno-PIE --sysroot=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0/recipe-sysroot -DHAVE_CONFIG_H -I. -I../../git/src -I.. -DSYSCONFDIR="/etc" -DRUNSTATEDIR="/var/run" -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -W -Wall -Wextra -Wno-unused-result -Wno-unused-parameter -fno-strict-aliasing -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0=/usr/src/debug/sysklogd/2.0.3-r0 -fdebug-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0=/usr/src/debug/sysklogd/2.0.3-r0 -fdebug-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0/recipe-sysroot= -fdebug-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0/recipe-sysroot-native= -c ../../git/src/syslog.c -fPIC -DPIC -o .libs/libsyslog_la-syslog.o
aarch64-wrs-linux-libtool: compile: ccache aarch64-wrs-linux-gcc -march=armv8-a+crc -no-pie -fno-PIE --sysroot=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0/recipe-sysroot -DHAVE_CONFIG_H -I. -I../../git/src -I.. -DSYSCONFDIR="/etc" -DRUNSTATEDIR="/var/run" -D_BSD_SOURCE -D_DEFAULT_SOURCE -W -Wall -Wextra -Wno-unused-result -Wno-unused-parameter -fno-strict-aliasing -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0=/usr/src/debug/sysklogd/2.0.3-r0 -fdebug-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0=/usr/src/debug/sysklogd/2.0.3-r0 -fdebug-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0/recipe-sysroot= -fdebug-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0/recipe-sysroot-native= -c ../../git/src/../lib/strlcpy.c -fPIC -DPIC -o ../lib/.libs/strlcpy.o
../aarch64-wrs-linux-libtool --tag=CC --mode=compile ccache aarch64-wrs-linux-gcc -march=armv8-a+crc -no-pie -fno-PIE --sysroot=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0/recipe-sysroot -DHAVE_CONFIG_H -I. -I../../git/src -I.. -DSYSCONFDIR="/etc" -DRUNSTATEDIR="/var/run" -D_BSD_SOURCE -D_DEFAULT_SOURCE -W -Wall -Wextra -Wno-unused-result -Wno-unused-parameter -fno-strict-aliasing -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0=/usr/src/debug/sysklogd/2.0.3-r0 -fdebug-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0=/usr/src/debug/sysklogd/2.0.3-r0 -fdebug-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0/recipe-sysroot= -fdebug-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0/recipe-sysroot-native= -c -o ../lib/strlcat.lo ../../git/src/../lib/strlcat.c
aarch64-wrs-linux-libtool: compile: ccache aarch64-wrs-linux-gcc -march=armv8-a+crc -no-pie -fno-PIE --sysroot=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0/recipe-sysroot -DHAVE_CONFIG_H -I. -I../../git/src -I.. -DSYSCONFDIR="/etc" -DRUNSTATEDIR="/var/run" -D_BSD_SOURCE -D_DEFAULT_SOURCE -W -Wall -Wextra -Wno-unused-result -Wno-unused-parameter -fno-strict-aliasing -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0=/usr/src/debug/sysklogd/2.0.3-r0 -fdebug-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0=/usr/src/debug/sysklogd/2.0.3-r0 -fdebug-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0/recipe-sysroot= -fdebug-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0/recipe-sysroot-native= -c ../../git/src/../lib/strlcat.c -fPIC -DPIC -o ../lib/.libs/strlcat.o
../aarch64-wrs-linux-libtool --tag=CC --mode=link ccache aarch64-wrs-linux-gcc -march=armv8-a+crc -no-pie -fno-PIE --sysroot=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0/recipe-sysroot -W -Wall -Wextra -Wno-unused-result -Wno-unused-parameter -fno-strict-aliasing -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0=/usr/src/debug/sysklogd/2.0.3-r0 -fdebug-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0=/usr/src/debug/sysklogd/2.0.3-r0 -fdebug-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0/recipe-sysroot= -fdebug-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0/recipe-sysroot-native= -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -o syslogd syslogd-syslogd.o syslogd-socket.o ../lib/pidfile.o ../lib/strlcpy.o ../lib/strlcat.o
aarch64-wrs-linux-libtool: link: ccache aarch64-wrs-linux-gcc -march=armv8-a+crc -no-pie -fno-PIE --sysroot=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0/recipe-sysroot -W -Wall -Wextra -Wno-unused-result -Wno-unused-parameter -fno-strict-aliasing -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0=/usr/src/debug/sysklogd/2.0.3-r0 -fdebug-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0=/usr/src/debug/sysklogd/2.0.3-r0 -fdebug-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0/recipe-sysroot= -fdebug-prefix-map=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0/recipe-sysroot-native= -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -o syslogd syslogd-syslogd.o syslogd-socket.o ../lib/pidfile.o ../lib/strlcpy.o ../lib/strlcat.o
aarch64-wrs-linux-gcc: error: ../lib/strlcat.o: No such file or directory
make[2]: *** [Makefile:620: syslogd] Error 1
make[2]: *** Waiting for unfinished jobs....
aarch64-wrs-linux-libtool: compile: ccache aarch64-wrs-linux-gcc -march=armv8-a+crc -no-pie -fno-PIE --sysroot=TOPDIR/tmp-glibc/work/aarch64-wrs-linux/sysklogd/2.0.3-r0/recipe-sysroot -DHAVE_CONFIG

But I checked after compile stopped, strlcat.o existed, so I suspects there is parallel race condition, but I checked line 620 in Makefile, seems strlcat.o already in sysklogd's dependency,
Could you help to see what maybe the problem? Thanks

Support for buffering messages until network comes up

When a remote target is configured and networking is not yet up we drop messages and retry with the next message. For some use-cases this is not good enough.

NetBSD syslogd has implemented struct buf_msg which is used for queuing messages for certain log targets. They do not support UDP remote hosts (F_FORW) with this mechanism, only F_FILE, F_TTY, F_FIFO, F_PIPE, and possibly (the new secure TLS over TCP mech) F_TLS, but the concept should work also for UDP. Look for F_FORW, UdpSend() and cases EHOSTDOWN, EHOSTUNREACH, and ENETDOWN.

http://cvsweb.netbsd.org/bsdweb.cgi/src/usr.sbin/syslogd/syslogd.c?rev=1.131&content-type=text/x-cvsweb-markup


Grafting the struct buf_msg construct onto sysklogd would entail a lot of work since it means refactoring the internals and irrevocably going down the NetBSD track with the sysklogd project. This is not necessarily a bad thing, would only make it harder to port features from FreeBSD. However, the NetBSD implementation is the current state of the art and includes support for, e.g., TLS which we want to add anyway.

The most important constraint, however, is adding a high watermark for memory use to message_queue_add(), to prevent this buffering mechanism from eating up all available memory on embedded targets. This watermark should be configurable by the user, similar to the log rotation feature. The queuing should probably also be implemented as ring buffer, so that when we reach the high water mark for buffered messages, we drop the first one(s) to make room for new messages.

Restarting syslogd repeats kernel log messages in log file(s)

Since v2.2.0, and the change from /proc/kmsg to /dev/kmsg, sysklogd repeats kernel log messages when restarting the daemon.

Comment: this is because reading from /dev/kmsg doesn't empty the ring buffer. This allows multiple consumers. The solution in syslogd could be to track the last read/logged sequence number.

Large delay before /dev/log is created on startup

In some cases (although maybe this is the behaviour everywhere?), it can take up to five whole seconds before /dev/log is opened. This poses a significant issue, as the entire init system has to stop and wait for syslogd, otherwise log messages from other services will be dropped.

I'm not entirely certain what the circumstances for this are. Some things improve startup time (such as compiling with -O3, which suggests that it's not just getting hung up on a timer), while other seemingly unrelated things cause startup time to drastically increase (startup takes about four seconds longer if the system hostname is set to anything other than an empty string).

For reference as to the performance relative to the rest of the system, the testing VM I used is able to start all services in under a quarter of a second of syslogd is disabled. If the user is quick at typing, they can boot and log in well before syslogd has opened the socket. It's by far the largest bottleneck to boot time.

Also worth noting that in my tests, log files were being written to a tmpfs, which means this is not disk speed causing a bottleneck.

Tests are flaky on low-power devices and CPU-limited containers

Some tests, like test/facility.sh, use hard-coded sleep statements to ensure that prior operations finish.

While running the test suite of sysklogd inside a heavily CPU-limited podman container, a few tests (test/memleak.sh test/facility.sh test/secure.sh test/remote.sh) showed flaky behaivior, i.e. they failed occasionally. The same behaivior showed on an old notebook with a > 10 year old i3 CPU running Debian 11. This may be a minor problem for CI environments, which often heavily restrict the available CPU time.

A simple solution would be to just sleep longer - however, this would increase the test suite runtime significantly, and I would assume that only a very small amount of users are affected by the flakyness in the first place. It may be a better idea to just add it to the documentation as a caveat.

Alternatively, it may be a good idea to, in case of an unexpected failure like an empty grep result, recheck and sleep a few times inside the tests and only fail after n retries.

syslogd: kernel logging broken if started without the -F option

If I start syslogd without the -F option, meaning in the background, logging of kernel messages is broken and I get the following error message:

Dec 7 11:56:24 jue syslogd[3431]: syslogd v2.0.3: restart
Dec 7 12:01:16 jue syslogd[3522]: klog read(): Bad file descriptor

Running syslogd in the foreground works, I've tested the following:

syslogd -F &
setsid syslogd -F
start-stop-daemon --start -bC --exec /usr/sbin/syslogd -- -F

Thanks!

syslogd under linux terminates with SIGPIPE with a small log buffer

If the kernel's log buffer is on the small side (certainly if CONFIG_LOG_BUF_SHIFT is 15 or less) then on boot up of a reasonably standard linux kernel, syslogd will terminate with a broken pipe error (presumably SIGPIPE). This arose with the adoption of /dev/kmsg instead of /proc/kmsg and seems to indicate a timing problem respecting the slackware scripts which start syslogd - this is not a systemd boot-up.

Reverting commit 5aa7372 resolves the issue.

There is more about it here: https://www.linuxquestions.org/questions/slackware-14/syslogd-problem-with-sysklogd-2-2-0-a-4175688968/

Some logs are lost in syslog file at the early boot

When I use systemd as init process and sysklogd for logging down logs.


journald.conf(/etc/systemd/journald.conf) as below: 
-----
[Journal]
Storage=volatile
ForwardToSyslog=yes
MaxLevelSyslog=debug

and syslogd.service(/lib/systemd/system/syslogd.service):
...
[Service]
EnvironmentFile=-/etc/default/syslogd
ExecStart=/usr/sbin/syslogd -F $SYSLOGD_OPTS -p /run/systemd/journal/syslog
StandardOutput=null
Restart=on-failure
...

After I reboot board, the there are some differences between "journalctl" command output and "/var/volatile/log/syslog" file; I mean there are some logs lost in syslog file, which are just after "Starting Journal Service..." key word or so.

Untrusted kernel messages timestamp sub-second faking doesn't work

1e9f164 should have brought untrusted kernel messages timestamp sub-second faking but it doesn't seem so:

2023-06-18T09:52:32.924290+02:00 qeporkak syslogd 822 - - syslogd v2.5.0: restart.
[mostly kernel messages]
2023-06-18T09:52:31.246848+02:00 qeporkak kernel - - - In-situ OAM (IOAM) with IPv6
2023-06-18T09:52:33.000705+02:00 qeporkak rc.syslog 810 - - syslogd[822] v2.5.0: restarted.
2023-06-18T09:52:34.479375+02:00 qeporkak rc.inet1 897 - - lo: configuring interface
2023-06-18T09:52:34.497160+02:00 qeporkak rc.inet1 897 - - eth0: configuring interface
2023-06-18T09:52:34.530470+02:00 qeporkak rc.inet1 897 - - eth0: setting IPv4 addresses
2023-06-18T09:52:34.000000+02:00 qeporkak kernel - - - Generic FE-GE Realtek PHY r8169-0-300:00: attached PHY driver (mii_bus:phy_addr=r8169-0-300:00, irq=MAC)
2023-06-18T09:52:34.000000+02:00 qeporkak kernel - - - r8169 0000:03:00.0 eth0: Link is Down

Setting permissions for logged files

I couldn't find information on this anywhere. There's no mention of a way to change the permissions of the logged files and it seems impractical to do it externally. Are there plans to do it in the future or am I missing something?

I can just make /var/log not world readable, but some applications which are running as system users, can't access the directory this way.

Syslog with domain name as target not working if failing to resolve at boot

Westermo reports that logging to remote server using FQDN never works if the name cannot be resolved. They start syslogd very early at boot and only SIGHUP's it when system is reconfigured. In their case the system also has DHCP client enabled, including DNS assignment, so no networking until a good while after the system has booted (and acquired a DHCP lease with DNS), at which point syslogd does not retry the DNS lookup.

v2.0.3: kern.log is empty when sysklogd boot by systemd

version: sysklogd v2.0.3
conditions: use systemd to boot sysklogd on x86_64
result: kern.log is empty, and it will work rightly after restarting klogd manually.

I found klogd and syslogd's type has been change to simple from forking in xx.service. That causes klogd start to run atfer syslogd in about 15ms and it was hundreds ms before this change. I wonder if the short time cause kern.log empty and this args "--with-klogd-delay=SEC" is especially for this issue?

Minor: Upgrade to 2.5.2: Default mark interval sometimes buggy

DISCLAIMER: Nothing fatal, just nice to become fixed if confirmed. :-)

Upgrade from 2.5.0:

2023-12-16T14:20:00.572539+01:00 qeporkak rc.syslog 9623 - - syslogd[821] v2.5.0: exiting on signal 15.
2023-12-16T14:20:00.585404+01:00 qeporkak syslogd 821 - - exiting on signal 15
2023-12-16T14:20:00.805136+01:00 qeporkak syslogd 9662 - - syslogd v2.5.2: restart.
2023-12-16T14:20:00.931679+01:00 qeporkak rc.syslog 9622 - - syslogd[9662] v2.5.2: restarted.
[...]
2023-12-16T14:28:35.463660+01:00 qeporkak sudo 9870 - -     opty : TTY=pts/3 ; PWD=/tmp ; USER=root ; COMMAND=/usr/bin/bash -c 'echo subseconds >> /dev/kmsg' ; EXIT=0
2023-12-16T14:40:00.826174+01:00 qeporkak syslogd 9662 - - -- MARK --
[...]
2023-12-16T15:47:01.653317+01:00 qeporkak crond 993 - - FILE /var/spool/cron/crontabs/root USER root PID 10299 /usr/bin/run-parts /etc/cron.hourly 1> /dev/null 
2023-12-16T15:48:30.899172+01:00 qeporkak syslogd 9662 - - -- MARK --

Upgrade from 2.3.0:

2023-12-16T17:08:51.091519+01:00 vodopnik syslogd 855 - - exiting on signal 15
2023-12-16T17:08:51.151878+01:00 vodopnik syslogd 20733 - - syslogd v2.5.2: restart.
2023-12-16T17:08:51.160532+01:00 vodopnik sudo 20725 - - pam_unix(sudo:session): session closed for user root
2023-12-16T17:08:51.160658+01:00 vodopnik sudo 20725 - -     opty : TTY=pts/1 ; PWD=/tmp ; USER=root ; COMMAND=/usr/bin/bash -c '/etc/rc.d/rc.syslog stop; timeout 1 pwait -U root -P 1 syslogd; /etc/rc.d/rc.syslog start' ; EXIT=0
2023-12-16T17:09:21.152714+01:00 vodopnik syslogd 20733 - - -- MARK --
[...]
2023-12-16T18:54:08.739143+01:00 vodopnik sudo 20876 - -     opty : TTY=pts/0 ; PWD=/home/opty ; USER=root ; COMMAND=/usr/bin/sort /var/log/messages /var/log/syslog /var/log/debug /var/log/secure /var/log/cron ; EXIT=0
2023-12-16T19:12:21.310191+01:00 vodopnik syslogd 20733 - - -- MARK --

Another upgrade from 2.3.0:

2023-12-16T17:30:00.426779+01:00 zeryk syslogd 717 - - exiting on signal 15
2023-12-16T17:30:00.539748+01:00 zeryk syslogd 12698 - - syslogd v2.5.2: restart.
2023-12-16T17:30:00.567819+01:00 zeryk sudo 12690 - - pam_unix(sudo:session): session closed for user root
2023-12-16T17:30:00.568191+01:00 zeryk sudo 12690 - -     opty : TTY=pts/1 ; PWD=/tmp ; USER=root ; COMMAND=/usr/bin/bash -c '/etc/rc.d/rc.syslog stop; timeout 1 pwait -U root -P 1 syslogd; /etc/rc.d/rc.syslog start' ; EXIT=0
2023-12-16T17:30:30.540190+01:00 zeryk syslogd 12698 - - -- MARK --
[...]
2023-12-16T18:02:45.756859+01:00 zeryk kernel - - - [IPTABLES DROP]: IN=eth1 OUT= MAC=<snip> SRC=<snip> DST=<snip> LEN=44 TOS=0x00 PREC=0x00 TTL=232 ID=54321 PROTO=TCP SPT=54455 DPT=16161 WINDOW=65535 RES=0x00 SYN URGP=0 
2023-12-16T18:04:30.557294+01:00 zeryk syslogd 12698 - - -- MARK --
[...]
2023-12-16T18:24:01.297942+01:00 zeryk crond 1030 - - FILE /var/spool/cron/crontabs/opty USER opty PID 12791 /home/opty/bin/ntpdrift 
2023-12-16T18:24:30.567278+01:00 zeryk syslogd 12698 - - -- MARK --

First and third -- MARK -- in the very last example may relate to

sysklogd/man/syslogd.8

Lines 627 to 641 in 3332c55

The mark interval, as controlled by the
.Fl m Ar INTV
option, relies on an internal timer with 30 second granularity. Every
30 seconds
.Nm
will attempt to log the text
.Cd "-- MARK --"
with (the internal) facility
.Cd mark
and priority
.Cd info .
Every log target is traversed, if at least
.Ar INTV
minutes have passed since the log target was written to, the mark is
logged. Hence, it may be off by up to 30 seconds, this is by design.
?

syslog ignore selector (!=) not working

Hi there! Slackware user here.

After a limited success in downstream realm, I now come here asking for further assistance with the issue bellow.

I have the following rule on my netfilter based script:

LOG all -- anywhere anywhere LOG level warning prefix "RULE 7 -- DENY "

My /etc/syslog.conf have this rule:

# Log anything 'warn' or higher.
# Exclude netfilter, authpriv, cron, mail, and news. These are logged elsewhere.
*.warn;kern.!=warn;\
  authpriv.none;cron.none;mail.none;news.none -/var/log/syslog

This used to work fine so netfilter messages (kern.warning) won't be logged to /var/log/syslog. Since Slackware -current Mon Jan 18 13:50:16 UTC 2021 changelog, when sysklogd was updated to 2.2.0, I noted that these warning messages are back in /var/log/syslog.

kern.none (no kernel messages at all) and kern.!warn (no kernel warns and above) both works as expected, but kern.!=warn
don't (negate kernel warn level only).

I've already read all man syslog.conf, checked all the syslog rules and issues here, but I failed to found a way to get those kern.warning messages out of /var/log/syslog.

As proposed by a fellow Slackware user, the following rule work with limitations (i.e. do not log any kern.*):

*.warn;kern.none;kern.!=warn

So I'm here to report this issue, as it was already confirmed by others in downstream discussion.

Thanks in advance.

High cpu usage in LXD containers

This has been reproduced in CRUX distribution running in an LXD container. Every time syslogd is started it reaches 100% cpu utilization. It seems to be something specific to running in unprivileged containers.

DNS cache of host names

Any chance the syslogd could cache DNS queries for remote hosts sending down messages? For busy logging systems, this puts an un-necessary load on the DNS server by triggering a new PTR query for every received message, and while adding the hostname on the hosts file, this defeats the purpose of having a DNS available (plus increases maintenance as multiple hosts files now needs update, versus a single location)

2.2.3: no version message at daemon start

2.2.2 sysklogd writes a version string to the log file like the following:

May 15 11:18:42 jue syslogd[32090]: syslogd v2.2.2: restart.

Is it intentional that 2.2.3 dosn't print the version information at daemon start?

Migrate from /proc/kmsg to /dev/kmsg for kernel logs

Lars Wendler of Gentoo fame brought up this interesting little tidbit of information:

https://bugzilla.redhat.com/show_bug.cgi?id=952655#c13

Turns out we should be using /dev/kmsg on Linux. Similar to how the *BSDs are using /dev/klog. Needs some testing, of course, but should be a straight forward switch, which also makes it possible to start syslogd a lot earlier on embedded systems using devtmpfs. (We won't have to wait for /proc to be mounted.)

use of libsyslog

I don't know if this is intentionally, but currently klogd is linked against the shared library libsyslog but syslogd is not?

syslogd keeps asserting around epochalypse (2038)

Anonymous user reports strange behavior when starting up a 32-bit ARM based device around the time of the epochalypse (UNIX 2038 problem):

  1. Set clock to 2038, e,g, "date 2038-01-14"
  2. Reboot
  3. See what happens -- the behaviour will be strange, e.g, syslog continously restarting, ....
  4. Set clock back to current date, e.g., "date 2021-09-02 11:27"
  5. Reboot unit
  6. Everything seems to be normal

When receiving a syslog message, remote or local, in RFC3164 format, syslogd enters the parsemsg() function and delegates to parsemsg_rfc3164() for processing. In the above scenario the following occurs:

root@right:~# date
Tue Jan 19 03:13:13 UTC 2038
root@right:~# syslogd: syslogd.c:1042: parsemsg_rfc3164: Assertion `year >= tm_now.tm_year - 1' failed.

What we want is for syslogd to handle this more gracefully, possibly fall back to time(NULL), i.e. time now.

compile failed when do parallel build

Hi,

After below commit, I still met one compile fail during about 2 month.
84d70e6

This is the error log:

ERROR: Execution of 'TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/temp/run.do_compile.24857' failed with exit code 1:
make  all-recursive
make[1]: Entering directory 'TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/build'
Making all in example
make[2]: Entering directory 'TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/build/example'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory 'TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/build/example'
Making all in man
make[2]: Entering directory 'TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/build/man'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory 'TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/build/man'
Making all in src
make[2]: Entering directory 'TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/build/src'
x86_64-overc-linux-gcc  -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse --sysroot=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/recipe-sysroot -DHAVE_CONFIG_H -I. -I../../git/src -I..  -DSYSCONFDIR=\"/etc\" -DRUNSTATEDIR=\"/var/run\" -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600  -W -Wall -Wextra -Wno-unused-result -Wno-unused-parameter -fno-strict-aliasing -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0=/usr/src/debug/sysklogd/2.1.1-r0                      -fdebug-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0=/usr/src/debug/sysklogd/2.1.1-r0                      -fdebug-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/recipe-sysroot=                      -fdebug-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/recipe-sysroot-native=  -c -o syslogd-syslogd.o `test -f 'syslogd.c' || echo '../../git/src/'`syslogd.c
x86_64-overc-linux-gcc  -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse --sysroot=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/recipe-sysroot -DHAVE_CONFIG_H -I. -I../../git/src -I..  -DSYSCONFDIR=\"/etc\" -DRUNSTATEDIR=\"/var/run\" -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600  -W -Wall -Wextra -Wno-unused-result -Wno-unused-parameter -fno-strict-aliasing -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0=/usr/src/debug/sysklogd/2.1.1-r0                      -fdebug-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0=/usr/src/debug/sysklogd/2.1.1-r0                      -fdebug-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/recipe-sysroot=                      -fdebug-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/recipe-sysroot-native=  -c -o syslogd-socket.o `test -f 'socket.c' || echo '../../git/src/'`socket.c
x86_64-overc-linux-gcc  -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse --sysroot=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/recipe-sysroot -DHAVE_CONFIG_H -I. -I../../git/src -I..  -DSYSCONFDIR=\"/etc\" -DRUNSTATEDIR=\"/var/run\" -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600  -W -Wall -Wextra -Wno-unused-result -Wno-unused-parameter -fno-strict-aliasing -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0=/usr/src/debug/sysklogd/2.1.1-r0                      -fdebug-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0=/usr/src/debug/sysklogd/2.1.1-r0                      -fdebug-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/recipe-sysroot=                      -fdebug-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/recipe-sysroot-native=  -c -o syslogd-timer.o `test -f 'timer.c' || echo '../../git/src/'`timer.c
../x86_64-overc-linux-libtool  --tag=CC   --mode=compile x86_64-overc-linux-gcc  -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse --sysroot=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/recipe-sysroot -DHAVE_CONFIG_H -I. -I../../git/src -I..  -DSYSCONFDIR=\"/etc\" -DRUNSTATEDIR=\"/var/run\" -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600  -W -Wall -Wextra -Wno-unused-result -Wno-unused-parameter -fno-strict-aliasing -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0=/usr/src/debug/sysklogd/2.1.1-r0                      -fdebug-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0=/usr/src/debug/sysklogd/2.1.1-r0                      -fdebug-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/recipe-sysroot=                      -fdebug-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/recipe-sysroot-native=  -c -o libsyslog_la-syslog.lo `test -f 'syslog.c' || echo '../../git/src/'`syslog.c
x86_64-overc-linux-gcc  -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse --sysroot=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/recipe-sysroot -DHAVE_CONFIG_H -I. -I../../git/src -I..  -DSYSCONFDIR=\"/etc\" -DRUNSTATEDIR=\"/var/run\" -D_BSD_SOURCE -D_DEFAULT_SOURCE  -W -Wall -Wextra -Wno-unused-result -Wno-unused-parameter -fno-strict-aliasing -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0=/usr/src/debug/sysklogd/2.1.1-r0                      -fdebug-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0=/usr/src/debug/sysklogd/2.1.1-r0                      -fdebug-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/recipe-sysroot=                      -fdebug-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/recipe-sysroot-native=  -c -o ../lib/pidfile.o ../../git/src/../lib/pidfile.c
x86_64-overc-linux-gcc  -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse --sysroot=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/recipe-sysroot -DHAVE_CONFIG_H -I. -I../../git/src -I..  -DSYSCONFDIR=\"/etc\" -DRUNSTATEDIR=\"/var/run\" -D_BSD_SOURCE -D_DEFAULT_SOURCE  -W -Wall -Wextra -Wno-unused-result -Wno-unused-parameter -fno-strict-aliasing -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0=/usr/src/debug/sysklogd/2.1.1-r0                      -fdebug-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0=/usr/src/debug/sysklogd/2.1.1-r0                      -fdebug-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/recipe-sysroot=                      -fdebug-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/recipe-sysroot-native=  -c -o ../lib/strlcpy.o ../../git/src/../lib/strlcpy.c
x86_64-overc-linux-gcc  -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse --sysroot=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/recipe-sysroot -DHAVE_CONFIG_H -I. -I../../git/src -I..  -DSYSCONFDIR=\"/etc\" -DRUNSTATEDIR=\"/var/run\" -D_BSD_SOURCE -D_DEFAULT_SOURCE  -W -Wall -Wextra -Wno-unused-result -Wno-unused-parameter -fno-strict-aliasing -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0=/usr/src/debug/sysklogd/2.1.1-r0                      -fdebug-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0=/usr/src/debug/sysklogd/2.1.1-r0                      -fdebug-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/recipe-sysroot=                      -fdebug-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/recipe-sysroot-native=  -c -o ../lib/strlcat.o ../../git/src/../lib/strlcat.c
../x86_64-overc-linux-libtool  --tag=CC   --mode=compile x86_64-overc-linux-gcc  -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse --sysroot=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/recipe-sysroot -DHAVE_CONFIG_H -I. -I../../git/src -I..  -DSYSCONFDIR=\"/etc\" -DRUNSTATEDIR=\"/var/run\" -D_BSD_SOURCE -D_DEFAULT_SOURCE  -W -Wall -Wextra -Wno-unused-result -Wno-unused-parameter -fno-strict-aliasing -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0=/usr/src/debug/sysklogd/2.1.1-r0                      -fdebug-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0=/usr/src/debug/sysklogd/2.1.1-r0                      -fdebug-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/recipe-sysroot=                      -fdebug-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/recipe-sysroot-native=  -c -o ../lib/pidfile.lo ../../git/src/../lib/pidfile.c
x86_64-overc-linux-libtool: compile:  x86_64-overc-linux-gcc -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse --sysroot=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/recipe-sysroot -DHAVE_CONFIG_H -I. -I../../git/src -I.. -DSYSCONFDIR=\"/etc\" -DRUNSTATEDIR=\"/var/run\" -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -W -Wall -Wextra -Wno-unused-result -Wno-unused-parameter -fno-strict-aliasing -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0=/usr/src/debug/sysklogd/2.1.1-r0 -fdebug-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0=/usr/src/debug/sysklogd/2.1.1-r0 -fdebug-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/recipe-sysroot= -fdebug-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/recipe-sysroot-native= -c ../../git/src/syslog.c  -fPIC -DPIC -o .libs/libsyslog_la-syslog.o
x86_64-overc-linux-libtool: compile:  x86_64-overc-linux-gcc -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse --sysroot=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/recipe-sysroot -DHAVE_CONFIG_H -I. -I../../git/src -I.. -DSYSCONFDIR=\"/etc\" -DRUNSTATEDIR=\"/var/run\" -D_BSD_SOURCE -D_DEFAULT_SOURCE -W -Wall -Wextra -Wno-unused-result -Wno-unused-parameter -fno-strict-aliasing -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0=/usr/src/debug/sysklogd/2.1.1-r0 -fdebug-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0=/usr/src/debug/sysklogd/2.1.1-r0 -fdebug-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/recipe-sysroot= -fdebug-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/recipe-sysroot-native= -c ../../git/src/../lib/pidfile.c  -fPIC -DPIC -o ../lib/.libs/pidfile.o
../x86_64-overc-linux-libtool  --tag=CC   --mode=compile x86_64-overc-linux-gcc  -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse --sysroot=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/recipe-sysroot -DHAVE_CONFIG_H -I. -I../../git/src -I..  -DSYSCONFDIR=\"/etc\" -DRUNSTATEDIR=\"/var/run\" -D_BSD_SOURCE -D_DEFAULT_SOURCE  -W -Wall -Wextra -Wno-unused-result -Wno-unused-parameter -fno-strict-aliasing -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0=/usr/src/debug/sysklogd/2.1.1-r0                      -fdebug-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0=/usr/src/debug/sysklogd/2.1.1-r0                      -fdebug-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/recipe-sysroot=                      -fdebug-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/recipe-sysroot-native=  -c -o ../lib/strlcpy.lo ../../git/src/../lib/strlcpy.c
x86_64-overc-linux-libtool: compile:  x86_64-overc-linux-gcc -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse --sysroot=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/recipe-sysroot -DHAVE_CONFIG_H -I. -I../../git/src -I.. -DSYSCONFDIR=\"/etc\" -DRUNSTATEDIR=\"/var/run\" -D_BSD_SOURCE -D_DEFAULT_SOURCE -W -Wall -Wextra -Wno-unused-result -Wno-unused-parameter -fno-strict-aliasing -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0=/usr/src/debug/sysklogd/2.1.1-r0 -fdebug-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0=/usr/src/debug/sysklogd/2.1.1-r0 -fdebug-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/recipe-sysroot= -fdebug-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/recipe-sysroot-native= -c ../../git/src/../lib/strlcpy.c  -fPIC -DPIC -o ../lib/.libs/strlcpy.o
../x86_64-overc-linux-libtool  --tag=CC   --mode=compile x86_64-overc-linux-gcc  -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse --sysroot=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/recipe-sysroot -DHAVE_CONFIG_H -I. -I../../git/src -I..  -DSYSCONFDIR=\"/etc\" -DRUNSTATEDIR=\"/var/run\" -D_BSD_SOURCE -D_DEFAULT_SOURCE  -W -Wall -Wextra -Wno-unused-result -Wno-unused-parameter -fno-strict-aliasing -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0=/usr/src/debug/sysklogd/2.1.1-r0                      -fdebug-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0=/usr/src/debug/sysklogd/2.1.1-r0                      -fdebug-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/recipe-sysroot=                      -fdebug-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/recipe-sysroot-native=  -c -o ../lib/strlcat.lo ../../git/src/../lib/strlcat.c
x86_64-overc-linux-libtool: compile:  x86_64-overc-linux-gcc -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse --sysroot=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/recipe-sysroot -DHAVE_CONFIG_H -I. -I../../git/src -I.. -DSYSCONFDIR=\"/etc\" -DRUNSTATEDIR=\"/var/run\" -D_BSD_SOURCE -D_DEFAULT_SOURCE -W -Wall -Wextra -Wno-unused-result -Wno-unused-parameter -fno-strict-aliasing -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0=/usr/src/debug/sysklogd/2.1.1-r0 -fdebug-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0=/usr/src/debug/sysklogd/2.1.1-r0 -fdebug-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/recipe-sysroot= -fdebug-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/recipe-sysroot-native= -c ../../git/src/../lib/strlcat.c  -fPIC -DPIC -o ../lib/.libs/strlcat.o
x86_64-overc-linux-libtool: compile:  x86_64-overc-linux-gcc -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse --sysroot=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/recipe-sysroot -DHAVE_CONFIG_H -I. -I../../git/src -I.. -DSYSCONFDIR=\"/etc\" -DRUNSTATEDIR=\"/var/run\" -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -W -Wall -Wextra -Wno-unused-result -Wno-unused-parameter -fno-strict-aliasing -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0=/usr/src/debug/sysklogd/2.1.1-r0 -fdebug-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0=/usr/src/debug/sysklogd/2.1.1-r0 -fdebug-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/recipe-sysroot= -fdebug-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/recipe-sysroot-native= -c ../../git/src/syslog.c  -fPIC -DPIC -o libsyslog_la-syslog.o >/dev/null 2>&1
x86_64-overc-linux-libtool: compile:  x86_64-overc-linux-gcc -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse --sysroot=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/recipe-sysroot -DHAVE_CONFIG_H -I. -I../../git/src -I.. -DSYSCONFDIR=\"/etc\" -DRUNSTATEDIR=\"/var/run\" -D_BSD_SOURCE -D_DEFAULT_SOURCE -W -Wall -Wextra -Wno-unused-result -Wno-unused-parameter -fno-strict-aliasing -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0=/usr/src/debug/sysklogd/2.1.1-r0 -fdebug-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0=/usr/src/debug/sysklogd/2.1.1-r0 -fdebug-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/recipe-sysroot= -fdebug-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/recipe-sysroot-native= -c ../../git/src/../lib/strlcat.c  -fPIC -DPIC -o ../lib/strlcat.o >/dev/null 2>&1
x86_64-overc-linux-libtool: compile:  x86_64-overc-linux-gcc -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse --sysroot=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/recipe-sysroot -DHAVE_CONFIG_H -I. -I../../git/src -I.. -DSYSCONFDIR=\"/etc\" -DRUNSTATEDIR=\"/var/run\" -D_BSD_SOURCE -D_DEFAULT_SOURCE -W -Wall -Wextra -Wno-unused-result -Wno-unused-parameter -fno-strict-aliasing -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0=/usr/src/debug/sysklogd/2.1.1-r0 -fdebug-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0=/usr/src/debug/sysklogd/2.1.1-r0 -fdebug-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/recipe-sysroot= -fdebug-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/recipe-sysroot-native= -c ../../git/src/../lib/strlcpy.c  -fPIC -DPIC -o ../lib/strlcpy.o >/dev/null 2>&1
../x86_64-overc-linux-libtool  --tag=CC   --mode=link x86_64-overc-linux-gcc  -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse --sysroot=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/recipe-sysroot -W -Wall -Wextra -Wno-unused-result -Wno-unused-parameter -fno-strict-aliasing -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0=/usr/src/debug/sysklogd/2.1.1-r0                      -fdebug-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0=/usr/src/debug/sysklogd/2.1.1-r0                      -fdebug-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/recipe-sysroot=                      -fdebug-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/recipe-sysroot-native=   -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -o syslogd syslogd-syslogd.o syslogd-socket.o syslogd-timer.o  ../lib/pidfile.o ../lib/strlcpy.o ../lib/strlcat.o 
x86_64-overc-linux-libtool: compile:  x86_64-overc-linux-gcc -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse --sysroot=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/recipe-sysroot -DHAVE_CONFIG_H -I. -I../../git/src -I.. -DSYSCONFDIR=\"/etc\" -DRUNSTATEDIR=\"/var/run\" -D_BSD_SOURCE -D_DEFAULT_SOURCE -W -Wall -Wextra -Wno-unused-result -Wno-unused-parameter -fno-strict-aliasing -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0=/usr/src/debug/sysklogd/2.1.1-r0 -fdebug-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0=/usr/src/debug/sysklogd/2.1.1-r0 -fdebug-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/recipe-sysroot= -fdebug-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/recipe-sysroot-native= -c ../../git/src/../lib/pidfile.c  -fPIC -DPIC -o ../lib/pidfile.o >/dev/null 2>&1
x86_64-overc-linux-libtool: link: x86_64-overc-linux-gcc -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse --sysroot=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/recipe-sysroot -W -Wall -Wextra -Wno-unused-result -Wno-unused-parameter -fno-strict-aliasing -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0=/usr/src/debug/sysklogd/2.1.1-r0 -fdebug-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0=/usr/src/debug/sysklogd/2.1.1-r0 -fdebug-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/recipe-sysroot= -fdebug-prefix-map=TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/recipe-sysroot-native= -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -o syslogd syslogd-syslogd.o syslogd-socket.o syslogd-timer.o ../lib/pidfile.o ../lib/strlcpy.o ../lib/strlcat.o 
TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/recipe-sysroot-native/usr/bin/x86_64-overc-linux/../../libexec/x86_64-overc-linux/gcc/x86_64-overc-linux/9.2.0/ld: syslogd-syslogd.o: in function `main':
/usr/src/debug/sysklogd/2.1.1-r0/build/src/../../git/src/syslogd.c:417: undefined reference to `__pidfile'
TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/recipe-sysroot-native/usr/bin/x86_64-overc-linux/../../libexec/x86_64-overc-linux/gcc/x86_64-overc-linux/9.2.0/ld: /usr/src/debug/sysklogd/2.1.1-r0/build/src/../../git/src/syslogd.c:435: undefined reference to `__pidfile'
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:591: syslogd] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory 'TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/build/src'
make[1]: *** [Makefile:504: all-recursive] Error 1
make[1]: Leaving directory 'TOPDIR/tmp/work/core2-64-overc-linux/sysklogd/2.1.1-r0/build'
make: *** [Makefile:392: all] Error 2
WARNING: exit code 1 from a shell command.
``

Garbled process name in std log file output

Since sysklogd v2.4.1, with the introduction of 50f6ad7, std (RFC3164) log file output look like this:

Aug 12 11:46:19 anarchy @���@@: random: crng init done
Aug 12 11:46:19 anarchy @���@[1]: Starting sysklogd[415]
Aug 12 11:46:19 anarchy @@-1A[416]: network: udhcpc: started, v1.35.0 
Aug 12 11:46:19 anarchy @@��E@: 8021q: adding VLAN 0 to HW filter on device eth0
Aug 12 11:46:19 anarchy @@��E[1]: myLinux 2022.05-981-geda5590fa9, entering runlevel 2
Aug 12 11:46:19 anarchy @@N'G[1]: Starting dropbear[437]

Turns out the introduced change (copy-paste almost from libsyslog) was not properly tested. Using a stack variable for the composed process tag does not work since the stack buffer goes out of scope.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.