From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53560) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etYTL-00011h-U3 for guix-patches@gnu.org; Wed, 07 Mar 2018 07:47:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1etYTG-0006Xg-AM for guix-patches@gnu.org; Wed, 07 Mar 2018 07:47:07 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:40613) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1etYTG-0006Xb-79 for guix-patches@gnu.org; Wed, 07 Mar 2018 07:47:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1etYTF-0000ix-Up for guix-patches@gnu.org; Wed, 07 Mar 2018 07:47:01 -0500 Subject: [bug#30498] [WIP v2 shepherd] shepherd: If /dev/kmsg is writable, use it for logging. Resent-Message-ID: From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) References: <20180217122035.1443-1-dannym@scratchpost.org> <20180217164835.1178-1-dannym@scratchpost.org> <87muzvtyo3.fsf@gnu.org> <20180226233214.6fe40fa3@scratchpost.org> <87inai6b7w.fsf@gnu.org> <87bmg46d10.fsf@gnu.org> <20180303233715.7ec8a08c@scratchpost.org> <87371ea2jj.fsf@gnu.org> <20180306090905.77f528a9@scratchpost.org> Date: Wed, 07 Mar 2018 13:46:22 +0100 In-Reply-To: <20180306090905.77f528a9@scratchpost.org> (Danny Milosavljevic's message of "Tue, 6 Mar 2018 09:09:05 +0100") Message-ID: <87po4gt5nl.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Danny Milosavljevic Cc: 30498@debbugs.gnu.org Hello, Danny Milosavljevic skribis: >> There=E2=80=99s one thing we need to improve though: syslogd reads /proc= /kmsg >> and prefixes everything that comes from there with =E2=80=9Cvmunix=E2=80= =9D (as if it >> came from the kernel).=20=20 > > Also, apparently syslogd uses the timestamp of "when it read the messages > out of /dev/kmsg" as syslog entry timestamp *although* /dev/kmsg contains= its > own timestamps (as offsets-from-bootup). Hrmmm... Yeah, we could teach Inetutils=E2=80=99s syslogd to interpret those timesta= mps, although that=E2=80=99s a Linux-specific thing so care must be taken. > According to the Linux kernel documentation the /dev/kmsg ring buffer is > specifically allowed to be used by user processes (although they must not > impersonate the kernel - if they try, the specified priority is ignored), > so we're in the clear there. Yeah but still. From syslogd=E2=80=99s viewpoint, you can only assume that these messages originate in the kernel. > Later on, we should use /dev/log and fall back to /dev/kmsg and > then again use /dev/log as it gets available etc. I'm not sure > how to do the synchronisation (from shepherd's point of view, > syslogd asynchronously reads from /dev/kmsg and puts the messages > into its output files - so if we write to /dev/kmsg, then to > /dev/log, then to /dev/kmsg, then to /dev/log, is the message order > guaranteed?) syslogd will read a batch of messages from /dev/kmsg when it starts, so the order is not really honored in this case. I think that=E2=80=99s OK th= ough, because we don=E2=80=99t expect users to keep stopping/starting syslogd. = :-) Thanks, Ludo=E2=80=99.