Subject: | Code works with Solaris 8, but not with Solaris 10 |
Date: | Thu, 23 Oct 2008 09:59:09 -0400 |
To: | <bug-Sys-Syslog [...] rt.cpan.org> |
From: | "Yanakiev, Vladimir" <vladimir_yanakiev [...] fanniemae.com> |
I need to send syslog messages over local 'stream' interface, not on UDP
or TCP. Using Solaris 8, I have success:
root@labser12# uname -a
SunOS labser12 5.8 Generic_117350-54 sun4u sparc
SUNW,Ultra-250
root@labser12# pkginfo -l SUNWpl5u
PKGINST: SUNWpl5u
NAME: Perl 5.005_03
CATEGORY: system
ARCH: sparc
VERSION: 11.8.0,REV=2000.01.08.18.12
BASEDIR: /
VENDOR: Sun Microsystems, Inc.
DESC: Perl 5 programming language
PSTAMP: on28-patch20060307150522
INSTDATE: Jul 24 2008 11:44
HOTLINE: Please contact your local service provider
STATUS: completely installed
FILES: 535 installed pathnames
4 shared pathnames
3 linked files
63 directories
33 executables
9924 blocks used (approx)
root@labser12# cat test
#!/usr/bin/perl -w
########################################################################
#######
#
------------------------------------------------------------------------
-----
# Vladimir Yanakiev
# System Engineer
# (c) Fannie Mae
#
# October 14, 2008
#
#
========================================================================
=====
# 10/14/2008 s5uvry 1.00 First release.
#
========================================================================
=====
# Use progVersion=%I% for fudge and other scripts
managed by sccs.
my $progVersion=1.00;
my $progUserId=s5uvry;
#-----------------------------------------------
# Used OS modules
#-----------------------------------------------
use strict;
use File::stat;
use File::Basename;
use File::Path;
use Sys::Syslog qw(:DEFAULT setlogsock);
use Sys::Hostname;
#-----------------------------------------------
# Get host and command names:
my $Host = hostname;
if (-f "/etc/VRTSvcs/conf/sysname"){
open(NAME, "/etc/VRTSvcs/conf/sysname");
$Host=<NAME>;
close NAME;
}
my $Cmd=basename($0);
setlogsock('unix','/dev/console');
openlog('tester','ndelay,cons','user');
syslog('LOG_NOTICE|LOG_DAEMON', "Successful unix test");
closelog();
root@labser12# tail /var/adm/messages
.
.
.
Oct 23 09:34:28 labser12.fanniemae.com tester:
Successful unix test
If I replace the ('unix','/dev/console') with ('stream'), system
complains:
root@labser12# ./test
Invalid argument passed to setlogsock; must be 'unix' or
'inet' at ./test line 40
This code gives error message, but still works in Solaris 10:
root@labser14# uname -a
SunOS labser14 5.10 Generic_137111-06 sun4u sparc
SUNW,Sun-Fire-V240
root@labser14# pkginfo -l SUNWperl584core
PKGINST: SUNWperl584core
NAME: Perl 5.8.4 (core)
CATEGORY: system
ARCH: sparc
VERSION: 11.10.0,REV=2005.01.21.15.53
BASEDIR: /
VENDOR: Sun Microsystems, Inc.
DESC: Perl 5.8.4 programming language (core)
PSTAMP: on10-patch20080523141917
INSTDATE: Sep 30 2008 18:25
HOTLINE: Please contact your local service provider
STATUS: completely installed
FILES: 559 installed pathnames
18 shared pathnames
1 linked files
113 directories
36 executables
10042 blocks used (approx)
root@labser14# pkginfo -l SUNWperl584usr
PKGINST: SUNWperl584usr
NAME: Perl 5.8.4 (non-core)
CATEGORY: system
ARCH: sparc
VERSION: 11.10.0,REV=2005.01.21.15.53
BASEDIR: /
VENDOR: Sun Microsystems, Inc.
DESC: Perl 5.8.4 programming language (non-core)
PSTAMP: on10-patch20080523141918
INSTDATE: Sep 30 2008 18:25
HOTLINE: Please contact your local service provider
STATUS: completely installed
FILES: 938 installed pathnames
14 shared pathnames
2 linked files
78 directories
48 executables
41232 blocks used (approx)
root@labser14# ./test
unix passed to setlogsock, but path not available at
./test line 39
root@labser14# tail /var/adm/messages
.
.
.
.
Oct 23 09:48:27 labser14.fanniemae.com tester:
Successful unix test
If I try ('stream'), it simply doesn't send the message. What is wrong?
This e-mail and its attachments are confidential and solely for the
intended addressee(s). Do not share or use them without Fannie Mae's
approval. If received in error, contact the sender and delete them.