From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: Shepherd redirect stdout/stderr to syslog Date: Mon, 05 Sep 2016 23:14:08 +0200 Message-ID: <878tv6uk0v.fsf@gnu.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:53203) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bh1De-0000wi-2V for guix-devel@gnu.org; Mon, 05 Sep 2016 17:14:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bh1DY-0001zP-0d for guix-devel@gnu.org; Mon, 05 Sep 2016 17:14:16 -0400 In-Reply-To: (David Craven's message of "Mon, 5 Sep 2016 15:44:40 +0200") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: David Craven Cc: guix-devel David Craven skribis: >> Is redirecting stdout/stderr to syslog something that >> make-forkexec-constructor could/should do? > > I looked into what would be involved. I included a diff that I didn't > test and don't expect to work. > > The reason why I don't expect this to work is that running echo > "hello" > /dev/log errors. stracing logger "hello" shows that it makes > use of the socket and sendmsg syscalls instead of the usual open and > write syscalls. I don't understand why though, since what's the point > of everything being a file if they don't share the same interface? The important thing is the special format, which includes the date: sendto(3, "<13>Sep 5 23:09:51 ludo: foo", 29, 0, NULL, 0) =3D 29 misc/syslog.c:193 in glibc implements this. So we would need to pipe each daemon=E2=80=99s stdout/stderr to the Shepherd itself, which would select(2) on all these, prepend the right prefix, and write that to /dev/log, I think. Ludo=E2=80=99.