[systemd-devel] Redirecting logfile to journald

Lennart Poettering lennart at poettering.net
Mon Jul 25 14:14:51 UTC 2016


On Mon, 25.07.16 00:55, Juanjo Presa (juanjop at gmail.com) wrote:

> Hi, I'm running a service that only writes output to log file, not
> configurable. Then I'm trying to link the log file to /dev/stdout but I
> guess that is not enough to be received by journald because is not
> working.

Yes, this doesn't work right now, as the Linux kernel prohibits open()
on sockets, and systemd's service management connects stdout/stderr to
an AF_UNIX/SOCK_STREAM socket, and open("/dev/stdout") hence will
fail. There have been ideas how to fix that, and replace the socket by
a pipe, which would make this work, however so far nobody started
working on that. (patches very welcome!)

You could use a fifo in the file system as workound. Connect one side
to your app, and the other one to systemd-cat, and things should
work. But it isn't precisely pretty...

Sorry I don't have any better suggestion for you right now.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list