guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Shepherd redirect stdout/stderr to syslog


From: Ludovic Courtès
Subject: Re: Shepherd redirect stdout/stderr to syslog
Date: Mon, 05 Sep 2016 23:14:08 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

David Craven <address@hidden> 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) = 29

misc/syslog.c:193 in glibc implements this.

So we would need to pipe each daemon’s 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’.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]