syslog to localhost with controlchan

Russ Allbery rra at stanford.edu
Tue Dec 30 04:56:28 UTC 2003


Russ Allbery <rra at stanford.edu> writes:

> The difficulty with doing this unconditionally is that we then lose if
> syslogd is configured not to listen to network sockets.  Really, what we
> want controlchan to do is use the syslog() C API... I thought a current
> Sys::Syslog would just do that, but I believe I was mistaken.

> I wonder if there's some way of forcing that....

Hm.

    setlogsock $sock_type [$stream_location] (added in 5.004_02)
        Sets the socket type to be used for the next call to "openlog()" or
        "syslog()" and returns TRUE on success, undef on failure.

        A value of 'unix' will connect to the UNIX domain socket (in some
        systems a character special device) returned by the "_PATH_LOG"
        macro (if your system defines it), or /dev/log or /dev/conslog,
        whatever is writable. A value of 'stream' will connect to the stream
        indicated by the pathname provided as the optional second parameter.
        (For example Solaris and IRIX require 'stream' instead of 'unix'.) A
        value of 'inet' will connect to an INET socket (either tcp or udp,
        tried in that order) returned by getservbyname(). 'tcp' and 'udp'
        can also be given as values. The value 'console' will send messages
        directly to the console, as for the 'cons' option in the logopts in
        openlog().

        A reference to an array can also be passed as the first parameter.
        When this calling method is used, the array should contain a list of
        sock_types which are attempted in order.

        The default is to try tcp, udp, unix, stream, console.

I wonder if calling:

    setlogsock [ 'unix', 'stream', 'tcp', 'udp', 'console' ];

would do what we want, and if that's portable back to the oldest version
of Perl that we care about....  No, it looks like the array form was added
in 5.8.0.  Hm.  We could try using that only with recent versions of Perl,
since OS X seems to have a pretty current one.

-- 
Russ Allbery (rra at stanford.edu)             <http://www.eyrie.org/~eagle/>

    Please send questions to the list rather than mailing me directly.
     <http://www.eyrie.org/~eagle/faqs/questions.html> explains why.


More information about the inn-workers mailing list