views:

484

answers:

3

Has anyone got Sys::Syslog to work on Solaris? (I'm running Sys::Syslog 0.05 on Perl v5.8.4 on SunOS 5.10 on SPARC). Here's what doesn't work for me:

openlog "myprog", "pid", "user" or die;
syslog "crit", "%s", "Test from $0" or die;
closelog() or warn "Can't close: $!";
system "tail /var/adm/messages";

Whatever I do, the closelog returns an error and nothing ever gets logged anywhere.

+3  A: 

By default, Sys::Syslog is going to try to connect with one of the following socket types:

[ 'tcp', 'udp', 'unix', 'stream' ]

On Solaris, though, you'll need to use an inet socket. Call:

setlogsock('inet', $hostname);

and things should start working.

rjbs
A: 

setlogsock('inet') didn't do it for me (it looks for host "syslog") but building and installing Sys::Syslog from CPAN did. The Sys::Syslog that comes with Solaris 10 is ancient.

+1  A: 

In general you can answer "does module $x work on platform $y" questions by looking at the CPAN testers matrix, like here.

moritz