From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42570) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1en5EX-0006lI-Ju for guix-patches@gnu.org; Sat, 17 Feb 2018 11:21:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1en5EU-0000bb-8w for guix-patches@gnu.org; Sat, 17 Feb 2018 11:21:05 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:40604) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1en5EU-0000bN-5O for guix-patches@gnu.org; Sat, 17 Feb 2018 11:21:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1en5ET-0007wx-Sd for guix-patches@gnu.org; Sat, 17 Feb 2018 11:21:01 -0500 Subject: [bug#30464] shepherd logging; console-agetty-service Resent-Message-ID: From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) References: <20180215114256.551-1-dannym@scratchpost.org> <20180215114742.663-1-dannym@scratchpost.org> <87r2pm8gfl.fsf@gnu.org> <20180215164135.188beed0@scratchpost.org> <878tbu8dat.fsf@gnu.org> <20180216215725.58607c8c@scratchpost.org> Date: Sat, 17 Feb 2018 17:20:06 +0100 In-Reply-To: <20180216215725.58607c8c@scratchpost.org> (Danny Milosavljevic's message of "Fri, 16 Feb 2018 21:57:25 +0100") Message-ID: <87sh9zk2q1.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: 30464@debbugs.gnu.org Hi, Danny Milosavljevic skribis: > On Thu, 15 Feb 2018 16:47:54 +0100 > ludo@gnu.org (Ludovic Court=C3=A8s) wrote: > >> (Which has me thinking that longer term it=E2=80=99d be nice to have the >> Shepherd take care of syslogd-ish activity.) > > If you mean that we should make sure to log shepherd's own messages, I ag= ree. That=E2=80=99s already done. > Integrating syslogd into shepherd, not sure. I think external syslogd is= fine. > If not, there are a lot of other logging programs to choose from. > I like modularity. Yes, I like it too. OTOH, there=E2=80=99s a chicken-and-egg problem here: shepherd ends up implementing its own logging facility, and we have situations like the one you mentioned earlier in this thread. > shepherd could write its messages to the kernel log ringbuffer in /dev/km= sg [3]. > That sounds dirty, but it would synchronize messages oh-so-nicely and wou= ld > not immediately require syslogd. It would also make sure that syslogd > eventually picks shepherd's messages up (right now they are somewhere on = the > first terminal - if you are lucky and they didn't scroll off). Indeed, that=E2=80=99s something we can easily do already, and it would add= ress a major annoyance. :-) Actually, could it use syslog(3), which writes to /dev/log? > Also a way of capturing stderr and stdout (and maybe even /dev/log) of se= rvices > would be nice. Yes. Though again capturing service stdout/stderr is kinda redundant with what syslogd does. What I like in journald is the fact that it unifies all logging facilities, and also connects them to service management. > We could also instead open /dev/klog and dup2 its fd to 1 and 2. > That way, shepherd messages and all stray messages by any process shepherd > started will end up in the kernel log. (problem: there are some reserved > patterns that have special meaning - and we don't control what the servic= es > do as well as we do what just shepherd does) Right, so we=E2=80=99d need shepherd to filter these and pass them through syslog(3), which ensures correct message formatting. That=E2=80=99s what does apparently (thanks for the link!). > Also, I know one is supposed to write UNIX services as daemons, but that's > not really composable and kinda complicated to debug for no good reason. > I'd prefer if shepherd also keeps a way to run regular programs as servic= es, > making sure that they are session leader, their output is logged, they are > kept alive and monitored. Sure! > daemontools[1][2] have done all this stuff already and I like it much more > than traditional service managers. It's much more modular, handles loggi= ng > on its own, handles error cases well, uses the file system well etc, hand= les > errors in the loggers (!). Sounds like a great source of inspiration then. :-) >> How about adding a =E2=80=98dependencies=E2=80=99 field to ? It=E2=80=99d >> default to the empty list, and could be set to '(syslogd) in this case. >>=20 >> Does that sound too obscure to you, or would it be OK? > > Sure, let's do that. > > It's a little weird to have it for all agettys, although maybe some other= users > of agetty require it anyway. > > Then I wonder if all guix shepherd service configs should have such a fie= ld. That brings us to the topic of a general service customization mechanism: . Well, one thing at a time. :-) Thanks for the great ideas! Ludo=E2=80=99.