Re: daemons logging to a file

[email protected] (Paul Jarc)
Newsgroups gmane.comp.djb.syslog
Organization What did you have in mind? A short, blunt, human pyramid?
Message-ID <[email protected]>
Bernhard Graf <[email protected]> wrote:
> I want to run a program under svscan with logs piped to multilog.
> Unfortunately this program can only log to either syslog or to a file.

Does it treat the filename "-" as shorthand for stdout?

> My first idea was a fifo, that is read by a program that prints to
> stdout (cat) and let the program log to this fifo ... something like
>
> test -e "$fifo" && rm -f "$fifo"
> mknod -m666 $fifo p

I see no reason to delete and recreate the fifo in the run script.
Just create it once, and let the daemon and multilog always use that
same fifo.

> cat $fifo &
> exec setuidgid $uid $program

You don't need cat.  multilog can read from the fifo instead of from
the pipe set up by svscan.  In log/run:
#!/bin/sh
exec \
setuidgid whoever \
multilog t ./main < ../fifo

> Has anyone a better idea (besides patching the program or using
> another one)?

If "-" doesn't work, ask the program's maintainer to allow logging to
stdout/stderr.


paul
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.