From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33630) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eqN98-00038Q-3F for guix-patches@gnu.org; Mon, 26 Feb 2018 13:05:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eqN94-0007eR-UC for guix-patches@gnu.org; Mon, 26 Feb 2018 13:05:06 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:54144) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eqN94-0007eG-PF for guix-patches@gnu.org; Mon, 26 Feb 2018 13:05:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eqN94-000777-9x for guix-patches@gnu.org; Mon, 26 Feb 2018 13:05:02 -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> Date: Mon, 26 Feb 2018 19:04:44 +0100 In-Reply-To: <20180217164835.1178-1-dannym@scratchpost.org> (Danny Milosavljevic's message of "Sat, 17 Feb 2018 17:48:35 +0100") Message-ID: <87muzvtyo3.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 Hi! Danny Milosavljevic skribis: > * modules/shepherd.scm (main): If /dev/kmsg is used, don't log to console > again - use only /dev/kmsg. Also redirect stderr to /dev/kmsg in > that case. > * modules/shepherd/comm.scm (%current-logfile-date-format): New variable. > (make-shepherd-output-port): Use it. Export. > * modules/shepherd/support.scm (default-logfile-date-format): New variabl= e. > (default-logfile): Use /dev/kmsg if writable. > (default-logfile-date-format): Drop duplicate timestamp. [...] > --- a/modules/shepherd.scm > +++ b/modules/shepherd.scm > @@ -141,12 +141,20 @@ > ;; Enable logging as first action. > (start-logging logfile) >=20=20 > + (if (string=3D? logfile "/dev/kmsg") > + ;; Prevent duplicate messages. > + (set-current-output-port (%make-void-port "w"))) Nitpick: I=E2=80=99d use =E2=80=98when=E2=80=99 here since there=E2=80=99s = no =E2=80=98else=E2=80=99 branch. > +(define %current-logfile-date-format > + (make-parameter default-logfile-date-format)) Please add a one-line comment explaining what the format is. Could you also add a couple of lines in the .texi file explaining that /dev/kmsg is used when it=E2=80=99s available and we=E2=80=99re running as = root? As for cryptsetup, what if the service that runs crypsetup simply parameterizes =E2=80=98log-output-port=E2=80=99 to /dev/console? That woul= d give us the current behavior, right? Apart from that it LGTM, thank you! Ludo=E2=80=99.