Sys::Syslog issue on Solaris 9 with perl-5.8.2

T

Thomas Glanzmann

Hello together,
I try to use a unix/socket syslog mechanism on Solaris 9 together with
perl-5.8.2 and get the following:

(faui04b) [~] cat syslog.pl
#!/opt/csw/bin/perl -w

use strict;
use Carp; $SIG{__DIE__} = \&Carp::confess;

use Sys::Syslog qw:)DEFAULT setlogsock); # default set, plus setlogsock
setlogsock('unix');
openlog('spamd', 'cons,pid', 'mail');
syslog('debug', "test application");
closelog();
(faui04b) [~] ./syslog.pl
unix dgram connect: Socket operation on non-socket at ./syslog.pl line 9
no connection to syslog available at ./syslog.pl line 9
Sys::Syslog::connect called at /opt/csw/lib/perl/5.8.2/Sys/Syslog.pm line 293
Sys::Syslog::syslog('debug','test application') called at ./syslog.pl line 9

Any ideas how I can fix the issue?

Thomas
 
B

Ben Morrow

Thomas Glanzmann said:
#!/opt/csw/bin/perl -w

use strict;
use Carp; $SIG{__DIE__} = \&Carp::confess;

use Sys::Syslog qw:)DEFAULT setlogsock); # default set, plus setlogsock
setlogsock('unix');
openlog('spamd', 'cons,pid', 'mail');
syslog('debug', "test application");
closelog();
unix dgram connect: Socket operation on non-socket at ./syslog.pl line 9
no connection to syslog available at ./syslog.pl line 9
Sys::Syslog::connect called at /opt/csw/lib/perl/5.8.2/Sys/Syslog.pm line 293
Sys::Syslog::syslog('debug','test application') called at ./syslog.pl line 9

Any ideas how I can fix the issue?

perldoc Sys::Syslog
| setlogsock...
<snip>
| 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'.)

Why are you using 'setlogsock' at all?

Ben
 
D

David Efflandt

Hello together,
I try to use a unix/socket syslog mechanism on Solaris 9 together with
perl-5.8.2 and get the following:

(faui04b) [~] cat syslog.pl
#!/opt/csw/bin/perl -w

use strict;
use Carp; $SIG{__DIE__} = \&Carp::confess;

use Sys::Syslog qw:)DEFAULT setlogsock); # default set, plus setlogsock
setlogsock('unix');
openlog('spamd', 'cons,pid', 'mail');
syslog('debug', "test application");
closelog();
(faui04b) [~] ./syslog.pl
unix dgram connect: Socket operation on non-socket at ./syslog.pl line 9
no connection to syslog available at ./syslog.pl line 9
Sys::Syslog::connect called at /opt/csw/lib/perl/5.8.2/Sys/Syslog.pm line 293
Sys::Syslog::syslog('debug','test application') called at ./syslog.pl line 9

Any ideas how I can fix the issue?

You fail to test if setlogmask() is successful? I don't have root access
on my Solaris ISP, but in Linux I do not use openlog(). I just initize it
with:

# Name of this script
if ($0 =~ m|/([^/]+)$|) { $id = $1; } else { $id = $0; }
use Sys::Syslog qw:)DEFAULT setlogsock);
setlogsock 'unix' || die "Can't setlogsock";


Then in my log sub I just (with $msg defined):

syslog('info',"$id\[$$]:$msg"); closelog();
 
T

Thomas Glanzmann

Hi Ben.

* Ben Morrow said:
| 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'.)

if I use stream. I get the following 'funny' syslog output:

Jan 10 09:04:05 faui04b said:
Why are you using 'setlogsock' at all?

Because the syslog mechanism defaults to inet. And I want it to work on
hosts where syslog doesn't listen on a udp/tcp/inet socket.

Thomas
 
T

Thomas Glanzmann

Hi,
You fail to test if setlogmask() is successful?

I don't have to. Look at the

use Carp; $SIG{__DIE__} = \&Carp::confess;

line.
I don't have root access on my Solaris ISP, but in Linux I do not use
openlog(). I just initize it with:

Yes openlog is redundant. But Solaris != Linux. And yes I know that this
progamm works without any problmes under Linux. However you don't answer
my question. I want stream or unix syslog on *Solaris 2.8 and 2.9*.

Thomas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top