3 use warnings::register;
6 use POSIX qw(strftime setlocale LC_TIME);
16 standard => [qw(openlog syslog closelog setlogmask)],
17 extended => [qw(setlogsock)],
21 LOG_ALERT LOG_CRIT LOG_DEBUG LOG_EMERG LOG_ERR
22 LOG_INFO LOG_NOTICE LOG_WARNING
27 LOG_AUTH LOG_AUTHPRIV LOG_CRON LOG_DAEMON LOG_FTP
28 LOG_INSTALL LOG_KERN LOG_LAUNCHD LOG_LFMT LOG_LOCAL0
29 LOG_LOCAL1 LOG_LOCAL2 LOG_LOCAL3 LOG_LOCAL4 LOG_LOCAL5
30 LOG_LOCAL6 LOG_LOCAL7 LOG_LPR LOG_MAIL LOG_NETINFO
31 LOG_NEWS LOG_RAS LOG_REMOTEAUTH LOG_SYSLOG LOG_USER LOG_UUCP
36 LOG_CONS LOG_PID LOG_NDELAY LOG_NOWAIT LOG_ODELAY LOG_PERROR
41 LOG_FACMASK LOG_NFACILITIES LOG_PRIMASK
48 @{$EXPORT_TAGS{standard}},
52 @{$EXPORT_TAGS{extended}},
53 @{$EXPORT_TAGS{macros}},
58 XSLoader::load('Sys::Syslog', $VERSION);
62 push @ISA, 'DynaLoader';
63 bootstrap Sys::Syslog $VERSION;
71 our $host; # host to send syslog messages to
76 my $connected = 0; # flag to indicate if we're connected or not
77 my $syslog_send; # coderef of the function used to send messages
78 my $syslog_path = undef; # syslog path for "stream" and "unix" mechanisms
79 my $transmit_ok = 0; # flag to indicate if the last message was transmited
80 my $current_proto = undef; # current mechanism used to transmit messages
81 my $ident = ''; # identifiant prepended to each message
82 my $facility = ''; # current facility
83 my $maskpri = LOG_UPTO(&LOG_DEBUG); # current log mask
92 # it would be nice to try stream/unix first, since that will be
93 # most efficient. However streams are dodgy - see _syslog_send_stream
94 my @connectMethods = qw(native tcp udp unix stream console);
95 if ($^O =~ /^(freebsd|linux)$/) {
96 @connectMethods = grep { $_ ne 'udp' } @connectMethods;
98 my @defaultMethods = @connectMethods;
99 my @fallbackMethods = ();
101 # coderef for a nicer handling of errors
102 my $err_sub = $options{nofatal} ? \&warnings::warnif : \&croak;
106 # This AUTOLOAD is used to 'autoload' constants from the constant()
110 ($constname = $AUTOLOAD) =~ s/.*:://;
111 croak "Sys::Syslog::constant() not defined" if $constname eq 'constant';
112 my ($error, $val) = constant($constname);
113 croak $error if $error;
115 *$AUTOLOAD = sub { $val };
121 ($ident, my $logopt, $facility) = @_;
123 for my $opt (split /\b/, $logopt) {
124 $options{$opt} = 1 if exists $options{$opt}
127 $err_sub = $options{nofatal} ? \&warnings::warnif : \&croak;
128 return 1 unless $options{ndelay};
133 $facility = $ident = '';
138 my $oldmask = $maskpri;
139 $maskpri = shift unless $_[0] == 0;
145 $syslog_path = shift;
146 disconnect_log() if $connected;
148 @fallbackMethods = ();
149 @connectMethods = @defaultMethods;
151 if (ref $setsock eq 'ARRAY') {
152 @connectMethods = @$setsock;
154 } elsif (lc $setsock eq 'stream') {
155 unless (defined $syslog_path) {
156 my @try = qw(/dev/log /dev/conslog);
157 if (length &_PATH_LOG) { # Undefined _PATH_LOG is "".
158 unshift @try, &_PATH_LOG;
166 warnings::warnif "stream passed to setlogsock, but could not find any device"
167 unless defined $syslog_path
169 unless (-w $syslog_path) {
170 warnings::warnif "stream passed to setlogsock, but $syslog_path is not writable";
173 @connectMethods = ( 'stream' );
176 } elsif (lc $setsock eq 'unix') {
177 if (length _PATH_LOG() || (defined $syslog_path && -w $syslog_path)) {
178 $syslog_path = _PATH_LOG() unless defined $syslog_path;
179 @connectMethods = ( 'unix' );
181 warnings::warnif 'unix passed to setlogsock, but path not available';
185 } elsif (lc $setsock eq 'native') {
186 @connectMethods = ( 'native' );
188 } elsif (lc $setsock eq 'tcp') {
189 if (getservbyname('syslog', 'tcp') || getservbyname('syslogng', 'tcp')) {
190 @connectMethods = ( 'tcp' );
192 warnings::warnif "tcp passed to setlogsock, but tcp service unavailable";
196 } elsif (lc $setsock eq 'udp') {
197 if (getservbyname('syslog', 'udp')) {
198 @connectMethods = ( 'udp' );
200 warnings::warnif "udp passed to setlogsock, but udp service unavailable";
204 } elsif (lc $setsock eq 'inet') {
205 @connectMethods = ( 'tcp', 'udp' );
207 } elsif (lc $setsock eq 'console') {
208 @connectMethods = ( 'console' );
211 croak "Invalid argument passed to setlogsock; must be 'stream', 'unix', 'native', 'tcp', 'udp' or 'inet'"
218 my $priority = shift;
221 my (@words, $num, $numpri, $numfac, $sum);
223 my $fail_time = undef;
226 my $facility = $facility; # may need to change temporarily.
228 croak "syslog: expecting argument \$priority" unless defined $priority;
229 croak "syslog: expecting argument \$format" unless defined $mask;
231 @words = split(/\W+/, $priority, 2); # Allow "level" or "level|facility".
236 $num = xlate($_); # Translate word to number.
238 croak "syslog: invalid level/facility: $_"
240 elsif ($num <= &LOG_PRIMASK) {
241 croak "syslog: too many levels given: $_" if defined $numpri;
243 return 0 unless LOG_MASK($numpri) & $maskpri;
246 croak "syslog: too many facilities given: $_" if defined $numfac;
252 croak "syslog: level must be given" unless defined $numpri;
254 if (not defined $numfac) { # Facility not specified in this call.
255 $facility = 'user' unless $facility;
256 $numfac = xlate($facility);
259 # if no identifiant, set up a default one
260 $ident ||= basename($0) || getlogin() || getpwuid($<) || 'syslog';
262 connect_log() unless $connected;
265 # escape percent signs for sprintf()
266 $error =~ s/%/%%/g if @_;
267 # replace %m with $err, if preceded by an even number of percent signs
268 $mask =~ s/(?<!%)((?:%%)*)%m/$1$error/g;
271 $mask .= "\n" unless $mask =~ /\n$/;
272 $message = @_ ? sprintf($mask, @_) : $mask;
274 if($current_proto eq 'native') {
279 $whoami .= "[$$]" if $options{pid};
281 $sum = $numpri + $numfac;
282 my $oldlocale = setlocale(LC_TIME);
283 setlocale(LC_TIME, 'C');
284 my $timestamp = strftime "%b %e %T", localtime;
285 setlocale(LC_TIME, $oldlocale);
286 $buf = "<$sum>$timestamp $whoami: $message\0";
289 # it's possible that we'll get an error from sending
290 # (e.g. if method is UDP and there is no UDP listener,
291 # then we'll get ECONNREFUSED on the send). So what we
292 # want to do at this point is to fallback onto a different
294 while (scalar @fallbackMethods || $syslog_send) {
295 if ($failed && (time - $fail_time) > 60) {
296 # it's been a while... maybe things have been fixed
297 @fallbackMethods = ();
299 $transmit_ok = 0; # make it look like a fresh attempt
303 if ($connected && !connection_ok()) {
304 # Something was OK, but has now broken. Remember coz we'll
305 # want to go back to what used to be OK.
306 $failed = $current_proto unless $failed;
311 connect_log() unless $connected;
312 $failed = undef if ($current_proto && $failed && $current_proto eq $failed);
315 if ($syslog_send->($buf, $numpri)) {
319 # typically doesn't happen, since errors are rare from write().
323 # could not send, could not fallback onto a working
324 # connection method. Lose.
328 sub _syslog_send_console {
330 chop($buf); # delete the NUL from the end
331 # The console print is a method which could block
332 # so we do it in a child process and always return success
334 if (my $pid = fork) {
336 if ($options{nowait}) {
339 if (waitpid($pid, 0) >= 0) {
342 # it's possible that the caller has other
343 # plans for SIGCHLD, so let's not interfere
348 if (open(CONS, ">/dev/console")) {
349 my $ret = print CONS $buf . "\r"; # XXX: should this be \x0A ?
350 exit $ret if defined $pid;
353 exit if defined $pid;
357 sub _syslog_send_stream {
359 # XXX: this only works if the OS stream implementation makes a write
360 # look like a putmsg() with simple header. For instance it works on
361 # Solaris 8 but not Solaris 7.
362 # To be correct, it should use a STREAMS API, but perl doesn't have one.
363 return syswrite(SYSLOG, $buf, length($buf));
366 sub _syslog_send_socket {
368 return syswrite(SYSLOG, $buf, length($buf));
369 #return send(SYSLOG, $buf, 0);
372 sub _syslog_send_native {
373 my ($buf, $numpri) = @_;
374 eval { syslog_xs($numpri, $buf) };
381 # private function to translate names to numeric values
385 return $name+0 if $name =~ /^\s*\d+\s*$/;
387 $name = "LOG_$name" unless $name =~ /^LOG_/;
388 $name = "Sys::Syslog::$name";
389 # Can't have just eval { &$name } || -1 because some LOG_XXX may be zero.
390 my $value = eval { no strict 'refs'; &$name };
391 defined $value ? $value : -1;
397 # This function acts as a kind of front-end: it tries to connect to
398 # a syslog service using the selected methods, trying each one in the
402 @fallbackMethods = @connectMethods unless scalar @fallbackMethods;
404 if ($transmit_ok && $current_proto) {
405 # Retry what we were on, because it has worked in the past.
406 unshift(@fallbackMethods, $current_proto);
413 while ($proto = shift @fallbackMethods) {
415 my $fn = "connect_$proto";
416 $connected = &$fn(\@errs) if defined &$fn;
422 $current_proto = $proto;
423 my($old) = select(SYSLOG); $| = 1; select($old);
425 @fallbackMethods = ();
426 $err_sub->(join "\n\t- ", "no connection to syslog available", @errs);
434 my $tcp = getprotobyname('tcp');
436 push @$errs, "getprotobyname failed for tcp";
440 my $syslog = getservbyname('syslog', 'tcp');
441 $syslog = getservbyname('syslogng', 'tcp') unless defined $syslog;
442 if (!defined $syslog) {
443 push @$errs, "getservbyname failed for syslog/tcp and syslogng/tcp";
449 $addr = inet_aton($host);
451 push @$errs, "can't lookup $host";
455 $addr = INADDR_LOOPBACK;
457 $addr = sockaddr_in($syslog, $addr);
459 if (!socket(SYSLOG, AF_INET, SOCK_STREAM, $tcp)) {
460 push @$errs, "tcp socket: $!";
463 setsockopt(SYSLOG, SOL_SOCKET, SO_KEEPALIVE, 1);
464 setsockopt(SYSLOG, &IPPROTO_TCP, &TCP_NODELAY, 1);
465 if (!connect(SYSLOG, $addr)) {
466 push @$errs, "tcp connect: $!";
470 $syslog_send = \&_syslog_send_socket;
478 my $udp = getprotobyname('udp');
480 push @$errs, "getprotobyname failed for udp";
484 my $syslog = getservbyname('syslog', 'udp');
485 if (!defined $syslog) {
486 push @$errs, "getservbyname failed for syslog/udp";
492 $addr = inet_aton($host);
494 push @$errs, "can't lookup $host";
498 $addr = INADDR_LOOPBACK;
500 $addr = sockaddr_in($syslog, $addr);
502 if (!socket(SYSLOG, AF_INET, SOCK_DGRAM, $udp)) {
503 push @$errs, "udp socket: $!";
506 if (!connect(SYSLOG, $addr)) {
507 push @$errs, "udp connect: $!";
511 # We want to check that the UDP connect worked. However the only
512 # way to do that is to send a message and see if an ICMP is returned
513 _syslog_send_socket("");
514 if (!connection_ok()) {
515 push @$errs, "udp connect: nobody listening";
519 $syslog_send = \&_syslog_send_socket;
526 # might want syslog_path to be variable based on syslog.h (if only
528 $syslog_path = '/dev/conslog' unless defined $syslog_path;
529 if (!-w $syslog_path) {
530 push @$errs, "stream $syslog_path is not writable";
533 if (!open(SYSLOG, ">" . $syslog_path)) {
534 push @$errs, "stream can't open $syslog_path: $!";
537 $syslog_send = \&_syslog_send_stream;
544 $syslog_path ||= _PATH_LOG() if length _PATH_LOG();
546 if (not defined $syslog_path) {
547 push @$errs, "_PATH_LOG not available in syslog.h and no user-supplied socket path";
551 if (! -S $syslog_path) {
552 push @$errs, "$syslog_path is not a socket";
556 my $addr = sockaddr_un($syslog_path);
558 push @$errs, "can't locate $syslog_path";
561 if (!socket(SYSLOG, AF_UNIX, SOCK_STREAM, 0)) {
562 push @$errs, "unix stream socket: $!";
565 if (!connect(SYSLOG, $addr)) {
566 if (!socket(SYSLOG, AF_UNIX, SOCK_DGRAM, 0)) {
567 push @$errs, "unix dgram socket: $!";
570 if (!connect(SYSLOG, $addr)) {
571 push @$errs, "unix dgram connect: $!";
576 $syslog_send = \&_syslog_send_socket;
585 # reconstruct the numeric equivalent of the options
586 for my $opt (keys %options) {
587 $logopt += xlate($opt) if $options{$opt}
590 eval { openlog_xs($ident, $logopt, xlate($facility)) };
596 $syslog_send = \&_syslog_send_native;
601 sub connect_console {
603 if (!-w '/dev/console') {
604 push @$errs, "console is not writable";
607 $syslog_send = \&_syslog_send_console;
611 # to test if the connection is still good, we need to check if any
612 # errors are present on the connection. The errors will not be raised
613 # by a write. Instead, sockets are made readable and the next read
614 # would cause the error to be returned. Unfortunately the syslog
615 # 'protocol' never provides anything for us to read. But with
616 # judicious use of select(), we can see if it would be readable...
618 return 1 if defined $current_proto and (
619 $current_proto eq 'native' or $current_proto eq 'console'
622 vec($rin, fileno(SYSLOG), 1) = 1;
623 my $ret = select $rin, undef, $rin, 0;
624 return ($ret ? 0 : 1);
629 $syslog_send = undef;
631 if($current_proto eq 'native') {
645 Sys::Syslog - Perl interface to the UNIX syslog(3) calls
653 use Sys::Syslog; # all except setlogsock(), or:
654 use Sys::Syslog qw(:DEFAULT setlogsock); # default set, plus setlogsock()
655 use Sys::Syslog qw(:standard :macros); # standard functions, plus macros
657 setlogsock $sock_type;
658 openlog $ident, $logopt, $facility; # don't forget this
659 syslog $priority, $format, @args;
660 $oldmask = setlogmask $mask_priority;
666 C<Sys::Syslog> is an interface to the UNIX C<syslog(3)> program.
667 Call C<syslog()> with a string priority and a list of C<printf()> args
668 just like C<syslog(3)>.
673 C<Sys::Syslog> exports the following C<Exporter> tags:
679 C<:standard> exports the standard C<syslog(3)> functions:
681 openlog closelog setlogmask syslog
685 C<:extended> exports the Perl specific functions for C<syslog(3)>:
691 C<:macros> exports the symbols corresponding to most of your C<syslog(3)>
692 macros and the C<LOG_UPTO()> and C<LOG_MASK()> functions.
693 See L<"CONSTANTS"> for the supported constants and their meaning.
697 By default, C<Sys::Syslog> exports the symbols from the C<:standard> tag.
704 =item B<openlog($ident, $logopt, $facility)>
707 C<$ident> is prepended to every message. C<$logopt> contains zero or
708 more of the options detailed below. C<$facility> specifies the part
709 of the system to report about, for example C<LOG_USER> or C<LOG_LOCAL0>:
710 see L<"Facilities"> for a list of well-known facilities, and your
711 C<syslog(3)> documentation for the facilities available in your system.
712 Check L<"SEE ALSO"> for useful links. Facility can be given as a string
715 This function will croak if it can't connect to the syslog daemon.
717 Note that C<openlog()> now takes three arguments, just like C<openlog(3)>.
719 B<You should use C<openlog()> before calling C<syslog()>.>
727 C<cons> - This option is ignored, since the failover mechanism will drop
728 down to the console automatically if all other media fail.
732 C<ndelay> - Open the connection immediately (normally, the connection is
733 opened when the first message is logged).
737 C<nofatal> - When set to true, C<openlog()> and C<syslog()> will only
738 emit warnings instead of dying if the connection to the syslog can't
743 C<nowait> - Don't wait for child processes that may have been created
744 while logging the message. (The GNU C library does not create a child
745 process, so this option has no effect on Linux.)
749 C<pid> - Include PID with each message.
755 Open the syslog with options C<ndelay> and C<pid>, and with facility C<LOCAL0>:
757 openlog($name, "ndelay,pid", "local0");
759 Same thing, but this time using the macro corresponding to C<LOCAL0>:
761 openlog($name, "ndelay,pid", LOG_LOCAL0);
764 =item B<syslog($priority, $message)>
766 =item B<syslog($priority, $format, @args)>
768 If C<$priority> permits, logs C<$message> or C<sprintf($format, @args)>
769 with the addition that C<%m> in $message or C<$format> is replaced with
770 C<"$!"> (the latest error message).
772 C<$priority> can specify a level, or a level and a facility. Levels and
773 facilities can be given as strings or as macros.
775 If you didn't use C<openlog()> before using C<syslog()>, C<syslog()> will
776 try to guess the C<$ident> by extracting the shortest prefix of
777 C<$format> that ends in a C<":">.
781 syslog("info", $message); # informational level
782 syslog(LOG_INFO, $message); # informational level
784 syslog("info|local0", $message); # information level, Local0 facility
785 syslog(LOG_INFO|LOG_LOCAL0, $message); # information level, Local0 facility
791 C<Sys::Syslog> version v0.07 and older passed the C<$message> as the
792 formatting string to C<sprintf()> even when no formatting arguments
793 were provided. If the code calling C<syslog()> might execute with
794 older versions of this module, make sure to call the function as
795 C<syslog($priority, "%s", $message)> instead of C<syslog($priority,
796 $message)>. This protects against hostile formatting sequences that
797 might show up if $message contains tainted data.
802 =item B<setlogmask($mask_priority)>
804 Sets the log mask for the current process to C<$mask_priority> and
805 returns the old mask. If the mask argument is 0, the current log mask
806 is not modified. See L<"Levels"> for the list of available levels.
807 You can use the C<LOG_UPTO()> function to allow all levels up to a
808 given priority (but it only accept the numeric macros as arguments).
814 setlogmask( LOG_MASK(LOG_ERR) );
816 Log everything except informational messages:
818 setlogmask( ~(LOG_MASK(LOG_INFO)) );
820 Log critical messages, errors and warnings:
822 setlogmask( LOG_MASK(LOG_CRIT) | LOG_MASK(LOG_ERR) | LOG_MASK(LOG_WARNING) );
824 Log all messages up to debug:
826 setlogmask( LOG_UPTO(LOG_DEBUG) );
829 =item B<setlogsock($sock_type)>
831 =item B<setlogsock($sock_type, $stream_location)> (added in Perl 5.004_02)
833 Sets the socket type to be used for the next call to
834 C<openlog()> or C<syslog()> and returns true on success,
835 C<undef> on failure. The available mechanisms are:
841 C<"native"> - use the native C functions from your C<syslog(3)> library
842 (added in C<Sys::Syslog> 0.15).
846 C<"tcp"> - connect to a TCP socket, on the C<syslog/tcp> or C<syslogng/tcp>
851 C<"udp"> - connect to a UDP socket, on the C<syslog/udp> service.
855 C<"inet"> - connect to an INET socket, either TCP or UDP, tried in that order.
859 C<"unix"> - connect to a UNIX domain socket (in some systems a character
860 special device). The name of that socket is the second parameter or, if
861 you omit the second parameter, the value returned by the C<_PATH_LOG> macro
862 (if your system defines it), or F</dev/log> or F</dev/conslog>, whatever is
867 C<"stream"> - connect to the stream indicated by the pathname provided as
868 the optional second parameter, or, if omitted, to F</dev/conslog>.
869 For example Solaris and IRIX system may prefer C<"stream"> instead of C<"unix">.
873 C<"console"> - send messages directly to the console, as for the C<"cons">
874 option of C<openlog()>.
878 A reference to an array can also be passed as the first parameter.
879 When this calling method is used, the array should contain a list of
880 mechanisms which are attempted in order.
882 The default is to try C<native>, C<tcp>, C<udp>, C<unix>, C<stream>, C<console>.
884 Giving an invalid value for C<$sock_type> will C<croak>.
888 Select the UDP socket mechanism:
892 Select the native, UDP socket then UNIX domain socket mechanisms:
894 setlogsock(["native", "udp", "unix"]);
900 Now that the "native" mechanism is supported by C<Sys::Syslog> and selected
901 by default, the use of the C<setlogsock()> function is discouraged because
902 other mechanisms are less portable across operating systems. Authors of
903 modules and programs that use this function, especially its cargo-cult form
904 C<setlogsock("unix")>, are advised to remove any occurence of it unless they
905 specifically want to use a given mechanism (like TCP or UDP to connect to
912 Closes the log file and returns true on success.
919 openlog($program, 'cons,pid', 'user');
920 syslog('info', '%s', 'this is another test');
921 syslog('mail|warning', 'this is a better test: %d', time);
924 syslog('debug', 'this is the last test');
927 openlog("$program $$", 'ndelay', 'user');
928 syslog('notice', 'fooprogram: this is really done');
932 syslog('info', 'problem was %m'); # %m == $! in syslog(3)
934 Log to UDP port on C<$remotehost> instead of logging locally:
937 $Sys::Syslog::host = $remotehost;
938 openlog($program, 'ndelay', 'user');
939 syslog('info', 'something happened over here');
950 C<LOG_AUTH> - security/authorization messages
954 C<LOG_AUTHPRIV> - security/authorization messages (private)
958 C<LOG_CRON> - clock daemons (B<cron> and B<at>)
962 C<LOG_DAEMON> - system daemons without separate facility value
966 C<LOG_FTP> - FTP daemon
970 C<LOG_KERN> - kernel messages
974 C<LOG_INSTALL> - installer subsystem
978 C<LOG_LAUNCHD> - launchd - general bootstrap daemon (Mac OS X)
982 C<LOG_LOCAL0> through C<LOG_LOCAL7> - reserved for local use
986 C<LOG_LPR> - line printer subsystem
990 C<LOG_MAIL> - mail subsystem
994 C<LOG_NETINFO> - NetInfo subsystem (Mac OS X)
998 C<LOG_NEWS> - USENET news subsystem
1002 C<LOG_RAS> - Remote Access Service (VPN / PPP) (Mac OS X)
1006 C<LOG_REMOTEAUTH> - remote authentication/authorization (Mac OS X)
1010 C<LOG_SYSLOG> - messages generated internally by B<syslogd>
1014 C<LOG_USER> (default) - generic user-level messages
1018 C<LOG_UUCP> - UUCP subsystem
1029 C<LOG_EMERG> - system is unusable
1033 C<LOG_ALERT> - action must be taken immediately
1037 C<LOG_CRIT> - critical conditions
1041 C<LOG_ERR> - error conditions
1045 C<LOG_WARNING> - warning conditions
1049 C<LOG_NOTICE> - normal, but significant, condition
1053 C<LOG_INFO> - informational message
1057 C<LOG_DEBUG> - debug-level message
1066 =item Invalid argument passed to setlogsock
1068 B<(F)> You gave C<setlogsock()> an invalid value for C<$sock_type>.
1070 =item no connection to syslog available
1072 B<(F)> C<syslog()> failed to connect to the specified socket.
1074 =item stream passed to setlogsock, but %s is not writable
1076 B<(W)> You asked C<setlogsock()> to use a stream socket, but the given
1077 path is not writable.
1079 =item stream passed to setlogsock, but could not find any device
1081 B<(W)> You asked C<setlogsock()> to use a stream socket, but didn't
1082 provide a path, and C<Sys::Syslog> was unable to find an appropriate one.
1084 =item tcp passed to setlogsock, but tcp service unavailable
1086 B<(W)> You asked C<setlogsock()> to use a TCP socket, but the service
1087 is not available on the system.
1089 =item syslog: expecting argument %s
1091 B<(F)> You forgot to give C<syslog()> the indicated argument.
1093 =item syslog: invalid level/facility: %s
1095 B<(F)> You specified an invalid level or facility.
1097 =item syslog: too many levels given: %s
1099 B<(F)> You specified too many levels.
1101 =item syslog: too many facilities given: %s
1103 B<(F)> You specified too many facilities.
1105 =item syslog: level must be given
1107 B<(F)> You forgot to specify a level.
1109 =item udp passed to setlogsock, but udp service unavailable
1111 B<(W)> You asked C<setlogsock()> to use a UDP socket, but the service
1112 is not available on the system.
1114 =item unix passed to setlogsock, but path not available
1116 B<(W)> You asked C<setlogsock()> to use a UNIX socket, but C<Sys::Syslog>
1117 was unable to find an appropriate an appropriate device.
1126 SUSv3 issue 6, IEEE Std 1003.1, 2004 edition,
1127 L<http://www.opengroup.org/onlinepubs/000095399/basedefs/syslog.h.html>
1129 GNU C Library documentation on syslog,
1130 L<http://www.gnu.org/software/libc/manual/html_node/Syslog.html>
1132 Solaris 10 documentation on syslog,
1133 L<http://docs.sun.com/app/docs/doc/816-5168/6mbb3hruo?a=view>
1135 AIX 5L 5.3 documentation on syslog,
1136 L<http://publib.boulder.ibm.com/infocenter/pseries/v5r3/index.jsp?topic=/com.ibm.aix.doc/libs/basetrf2/syslog.htm>
1138 HP-UX 11i documentation on syslog,
1139 L<http://docs.hp.com/en/B9106-90010/syslog.3C.html>
1141 Tru64 5.1 documentation on syslog,
1142 L<http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V51_HTML/MAN/MAN3/0193____.HTM>
1145 L<http://stratadoc.stratus.com/vos/15.1.1/r502-01/wwhelp/wwhimpl/js/html/wwhelp.htm?context=r502-01&file=ch5r502-01bi.html>
1147 I<RFC 3164 - The BSD syslog Protocol>, L<http://www.faqs.org/rfcs/rfc3164.html>
1148 -- Please note that this is an informational RFC, and therefore does not
1149 specify a standard of any kind.
1151 I<RFC 3195 - Reliable Delivery for syslog>, L<http://www.faqs.org/rfcs/rfc3195.html>
1153 I<Syslogging with Perl>, L<http://lexington.pm.org/meetings/022001.html>
1158 Tom Christiansen E<lt>F<tchrist@perl.com>E<gt> and Larry Wall
1159 E<lt>F<larry@wall.org>E<gt>.
1161 UNIX domain sockets added by Sean Robinson
1162 E<lt>F<robinson_s@sc.maricopa.edu>E<gt> with support from Tim Bunce
1163 E<lt>F<Tim.Bunce@ig.co.uk>E<gt> and the C<perl5-porters> mailing list.
1165 Dependency on F<syslog.ph> replaced with XS code by Tom Hughes
1166 E<lt>F<tom@compton.nu>E<gt>.
1168 Code for C<constant()>s regenerated by Nicholas Clark E<lt>F<nick@ccl4.org>E<gt>.
1170 Failover to different communication modes by Nick Williams
1171 E<lt>F<Nick.Williams@morganstanley.com>E<gt>.
1173 XS code for using native C functions borrowed from C<L<Unix::Syslog>>,
1174 written by Marcus Harnisch E<lt>F<marcus.harnisch@gmx.net>E<gt>.
1176 Extracted from core distribution for publishing on the CPAN by
1177 SE<eacute>bastien Aperghis-Tramoni E<lt>sebastien@aperghis.netE<gt>.
1182 Please report any bugs or feature requests to
1183 C<bug-sys-syslog at rt.cpan.org>, or through the web interface at
1184 L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Sys-Syslog>.
1185 I will be notified, and then you'll automatically be notified of progress on
1186 your bug as I make changes.
1191 You can find documentation for this module with the perldoc command.
1195 You can also look for information at:
1199 =item * AnnoCPAN: Annotated CPAN documentation
1201 L<http://annocpan.org/dist/Sys-Syslog>
1203 =item * CPAN Ratings
1205 L<http://cpanratings.perl.org/d/Sys-Syslog>
1207 =item * RT: CPAN's request tracker
1209 L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Sys-Syslog>
1213 L<http://search.cpan.org/dist/Sys-Syslog/>
1215 =item * Kobes' CPAN Search
1217 L<http://cpan.uwinnipeg.ca/dist/Sys-Syslog>
1219 =item * Perl Documentation
1221 L<http://perldoc.perl.org/Sys/Syslog.html>
1228 This program is free software; you can redistribute it and/or modify it
1229 under the same terms as Perl itself.