Re: log to multilog instead of file

richard lucassen <[email protected]>
Newsgroups gmane.comp.djb.syslog
Organization CAM S&C
Message-ID <[email protected]>
On Thu, 27 May 2004 13:06:27 +0200
Laurent Bercot <[email protected]> wrote:

> > I have program X. X writes to syslogd, but is also able to log to a
> > file with the -l option. X runs supervised and I want X to log
> > through multilog.
> > 
> > I now resolved this using a named pipe (daemontools-0.70):
> 
>  It should be okay.
>  (You might want to use daemontools-0.76 instead, to be able to
> rotate your logs at will with SIGALRM, for instance.)

0.70 still works perfectly well ;-)
 
> > But I'm afraid this is a rather dirty solution. Is there a solution
> > that is more elegant than this one?
> 
>  If your system provides /dev/stderr, /dev/fd/2, or such a device, you
> could use the -l option to log to that "file". This will use X's
> standard error, which you can then redirect to multilog's input.

Ok, this works great. I use /dev/stderr which is a symlink to
/proc/self/fd/2. Just a question: why not use /dev/stdout instead of
stderr?

R.


/usr/local/sbin/X/run:

#!/bin/sh
exec 2>&1
exec X -l /dev/stderr

/usr/local/sbin/X/log/run:

#!/bin/sh
exec /usr/local/bin/setuidgid Xlog \
/usr/local/bin/multilog t /var/log/X

-- 
___________________________________________________________________
Recursion: see recursion

+------------------------------------------------------------------+
| Richard Lucassen, Utrecht                                        |
| Public key and email address:                                    |
| http://www.lucassen.org/mail-pubkey.html                         |
+------------------------------------------------------------------+
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQFAtdOMyG85G+teVsIRAoXCAJ9eVz/daqTnJxPNbp+gavzBwYznsQCgojW/
AM6ZRTDC+IwUhbthAjoNpOg=
=b3xG
-----END PGP SIGNATURE-----
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.