Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Sys::Syslog under Solaris

Reply
Thread Tools

Sys::Syslog under Solaris

 
 
Loic Minier
Guest
Posts: n/a
 
      03-05-2004
Hi,

I have trouble using the Sys::Syslog package under Solaris. If I use
'stream', I don't get anything logged, and if I log via udp instead,
all my logs are prefixed with the program name ($ident). This doesn't
happen with other programs running on the same host.

Here's the relevant Perl :
use Sys::Syslog qw(EFAULT setlogsock);
#setlogsock('stream'); # doesn't work
setlogsock('inet'); # or udp
syslog('info', "test\n");

Any idea on how to get stream at work? Or to get rid of the prefix?

Thanks,

--
Loc Minier <(E-Mail Removed)>
 
Reply With Quote
 
 
 
 
David Efflandt
Guest
Posts: n/a
 
      03-05-2004
On Fri, 5 Mar 2004 14:09:51 +0100, Loic Minier <(E-Mail Removed)> wrote:
> Hi,
>
> I have trouble using the Sys::Syslog package under Solaris. If I use
> 'stream', I don't get anything logged, and if I log via udp instead,
> all my logs are prefixed with the program name ($ident). This doesn't
> happen with other programs running on the same host.
>
> Here's the relevant Perl :
> use Sys::Syslog qw(EFAULT setlogsock);
> #setlogsock('stream'); # doesn't work
> setlogsock('inet'); # or udp
> syslog('info', "test\n");
>
> Any idea on how to get stream at work? Or to get rid of the prefix?


I am not sure about 'stream' and do not have root access on my Solaris ISP
to check logs, but for Linux where I have a variable to indicate whether
it should log I have:

# grouped with other variable settings
# Flag for Unix syslog, 1 (yes), 0 (no)
BEGIN { $main::syslog = 1; }


# farther down...
# Name of this script
if ($0 =~ m|/([^/]+)$|) { $id = $1; } else { $id = $0; }

# Initialize local system log (unix)
BEGIN {
if ($main::syslog) {
use Sys::Syslog qw(EFAULT setlogsock);
setlogsock 'unix' || die "Can't setlogsock";
}
}

sub mylog {
my $msg = shift;
chomp $msg;
if ($syslog) { syslog('info',"$id\[$$]:$msg"); closelog(); }
# along w/other routines to optionally log to file, etc.
}

--
David Efflandt - All spam ignored http://www.de-srv.com/
 
Reply With Quote
 
 
 
 
Loic Minier
Guest
Posts: n/a
 
      03-06-2004
* David Efflandt <(E-Mail Removed)>,
Fri, 5 Mar 2004 19:31:02 +0000 (UTC):
> use Sys::Syslog qw(EFAULT setlogsock);
> setlogsock 'unix' || die "Can't setlogsock";


'unix' won't work with the standard Solaris syslogd since it doesn't
listen on an unix socket, but your post is particularly helpful because
I just realized that syslog-ng can probably create an unix socket!
I will try this on monday, when I will have access to the Solaris
boxes again. I'll keep the group informed.

Regards,

--
Loc Minier <(E-Mail Removed)>
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error when compiling under Solaris etienne C++ 2 07-13-2006 11:59 AM
Barton-Nackman and compilation under Solaris nguyenxuanson@gmail.com C++ 4 01-17-2006 05:09 PM
Anyone who can help me to compile a source code package under the Solaris platform? jing C++ 1 12-08-2005 03:19 PM
Waiting for processes to finish under Solaris Behrang Dadsetan Python 1 07-15-2003 07:56 PM
java font selection under solaris 8 Michael Glavitsch Java 1 07-15-2003 07:10 PM



Advertisments