[systemd-devel] How to log to journald using fifo?

Samuel Williams space.ship.traveller at gmail.com
Sun Apr 10 15:20:05 UTC 2016


I would like to write to /dev/stderr and tried that but it didn’t work. I think it’s something to do with the way it works internally (nginx + phusion passenger).

> On 11/04/2016, at 12:43 AM, Mantas Mikulėnas <grawity at gmail.com> wrote:
> 
> On Sun, Apr 10, 2016 at 1:57 PM, Samuel Williams <space.ship.traveller at gmail.com <mailto:space.ship.traveller at gmail.com>> wrote:
> Hello,
> 
> I've been trying to figure out the best way to support legacy applications that don't support syslog for logging. The best we can do, I think, is to use fifo and have another process read the fifo to journald.
> 
> I made the following unit journald-fifo at .service
> 
> [Unit]
> Description=A fifo for logging to journald
> AssertPathExists=/var/log/%i.fifo
> 
> [Service]
> Type=simple
> ExecStart=/bin/sh -c 'while true; do systemd-cat -t %i < /var/log/%i.fifo; done'
> Nice=5
> 
> [Install]
> WantedBy=multi-user.target
> 
> I was wondering is this a good approach? Is there a better way? (of course, we'd like to fix the original software to work better).
> 
> If the software can log to stdout/stderr, just use that. If not, make it write logs to "/dev/stderr". Either way, systemd will log service stdout automatically.
> 
> -- 
> Mantas Mikulėnas <grawity at gmail.com <mailto:grawity at gmail.com>>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20160411/8ca666b0/attachment.html>


More information about the systemd-devel mailing list