1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
|
.\" -*- mode: troff; coding: utf-8 -*-
.\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
.ie n \{\
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds C`
. ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is >0, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{\
. if \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{\
. nr % 0
. nr F 2
. \}
. \}
.\}
.rr rF
.\" ========================================================================
.\"
.IX Title "Sys::Syslog 3perl"
.TH Sys::Syslog 3perl 2024-02-11 "perl v5.38.2" "Perl Programmers Reference Guide"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH NAME
Sys::Syslog \- Perl interface to the UNIX syslog(3) calls
.SH VERSION
.IX Header "VERSION"
This is the documentation of version 0.36
.SH SYNOPSIS
.IX Header "SYNOPSIS"
.Vb 2
\& use Sys::Syslog; # all except setlogsock()
\& use Sys::Syslog qw(:standard :macros); # standard functions & macros
\&
\& openlog($ident, $logopt, $facility); # don\*(Aqt forget this
\& syslog($priority, $format, @args);
\& $oldmask = setlogmask($mask_priority);
\& closelog();
.Ve
.SH DESCRIPTION
.IX Header "DESCRIPTION"
\&\f(CW\*(C`Sys::Syslog\*(C'\fR is an interface to the UNIX \f(CWsyslog(3)\fR program.
Call \f(CWsyslog()\fR with a string priority and a list of \f(CWprintf()\fR args
just like \f(CWsyslog(3)\fR.
.SH EXPORTS
.IX Header "EXPORTS"
\&\f(CW\*(C`Sys::Syslog\*(C'\fR exports the following \f(CW\*(C`Exporter\*(C'\fR tags:
.IP \(bu 4
\&\f(CW\*(C`:standard\*(C'\fR exports the standard \f(CWsyslog(3)\fR functions:
.Sp
.Vb 1
\& openlog closelog setlogmask syslog
.Ve
.IP \(bu 4
\&\f(CW\*(C`:extended\*(C'\fR exports the Perl specific functions for \f(CWsyslog(3)\fR:
.Sp
.Vb 1
\& setlogsock
.Ve
.IP \(bu 4
\&\f(CW\*(C`:macros\*(C'\fR exports the symbols corresponding to most of your \f(CWsyslog(3)\fR
macros and the \f(CWLOG_UPTO()\fR and \f(CWLOG_MASK()\fR functions.
See "CONSTANTS" for the supported constants and their meaning.
.PP
By default, \f(CW\*(C`Sys::Syslog\*(C'\fR exports the symbols from the \f(CW\*(C`:standard\*(C'\fR tag.
.SH FUNCTIONS
.IX Header "FUNCTIONS"
.ie n .IP "\fBopenlog($ident, \fR\fB$logopt\fR\fB, \fR\fB$facility\fR\fB)\fR" 4
.el .IP "\fBopenlog($ident, \fR\f(CB$logopt\fR\fB, \fR\f(CB$facility\fR\fB)\fR" 4
.IX Item "openlog($ident, $logopt, $facility)"
Opens the syslog.
\&\f(CW$ident\fR is prepended to every message. \f(CW$logopt\fR contains zero or
more of the options detailed below. \f(CW$facility\fR specifies the part
of the system to report about, for example \f(CW\*(C`LOG_USER\*(C'\fR or \f(CW\*(C`LOG_LOCAL0\*(C'\fR:
see "Facilities" for a list of well-known facilities, and your
\&\f(CWsyslog(3)\fR documentation for the facilities available in your system.
Check "SEE ALSO" for useful links. Facility can be given as a string
or a numeric macro.
.Sp
This function will croak if it can't connect to the syslog daemon.
.Sp
Note that \f(CWopenlog()\fR now takes three arguments, just like \f(CWopenlog(3)\fR.
.Sp
\&\fBYou should use \fR\f(CBopenlog()\fR\fB before calling \fR\f(CBsyslog()\fR\fB.\fR
.Sp
\&\fBOptions\fR
.RS 4
.IP \(bu 4
\&\f(CW\*(C`cons\*(C'\fR \- This option is ignored, since the failover mechanism will drop
down to the console automatically if all other media fail.
.IP \(bu 4
\&\f(CW\*(C`ndelay\*(C'\fR \- Open the connection immediately (normally, the connection is
opened when the first message is logged).
.IP \(bu 4
\&\f(CW\*(C`noeol\*(C'\fR \- When set to true, no end of line character (\f(CW\*(C`\en\*(C'\fR) will be
appended to the message. This can be useful for some syslog daemons.
Added in \f(CW\*(C`Sys::Syslog\*(C'\fR 0.29.
.IP \(bu 4
\&\f(CW\*(C`nofatal\*(C'\fR \- When set to true, \f(CWopenlog()\fR and \f(CWsyslog()\fR will only
emit warnings instead of dying if the connection to the syslog can't
be established. Added in \f(CW\*(C`Sys::Syslog\*(C'\fR 0.15.
.IP \(bu 4
\&\f(CW\*(C`nonul\*(C'\fR \- When set to true, no \f(CW\*(C`NUL\*(C'\fR character (\f(CW\*(C`\e0\*(C'\fR) will be
appended to the message. This can be useful for some syslog daemons.
Added in \f(CW\*(C`Sys::Syslog\*(C'\fR 0.29.
.IP \(bu 4
\&\f(CW\*(C`nowait\*(C'\fR \- Don't wait for child processes that may have been created
while logging the message. (The GNU C library does not create a child
process, so this option has no effect on Linux.)
.IP \(bu 4
\&\f(CW\*(C`perror\*(C'\fR \- Write the message to standard error output as well to the
system log. Added in \f(CW\*(C`Sys::Syslog\*(C'\fR 0.22.
.IP \(bu 4
\&\f(CW\*(C`pid\*(C'\fR \- Include PID with each message.
.RE
.RS 4
.Sp
\&\fBExamples\fR
.Sp
Open the syslog with options \f(CW\*(C`ndelay\*(C'\fR and \f(CW\*(C`pid\*(C'\fR, and with facility \f(CW\*(C`LOCAL0\*(C'\fR:
.Sp
.Vb 1
\& openlog($name, "ndelay,pid", "local0");
.Ve
.Sp
Same thing, but this time using the macro corresponding to \f(CW\*(C`LOCAL0\*(C'\fR:
.Sp
.Vb 1
\& openlog($name, "ndelay,pid", LOG_LOCAL0);
.Ve
.RE
.ie n .IP "\fBsyslog($priority, \fR\fB$message\fR\fB)\fR" 4
.el .IP "\fBsyslog($priority, \fR\f(CB$message\fR\fB)\fR" 4
.IX Item "syslog($priority, $message)"
.PD 0
.ie n .IP "\fBsyslog($priority, \fR\fB$format\fR\fB, \fR\fB@args\fR\fB)\fR" 4
.el .IP "\fBsyslog($priority, \fR\f(CB$format\fR\fB, \fR\f(CB@args\fR\fB)\fR" 4
.IX Item "syslog($priority, $format, @args)"
.PD
If \f(CW$priority\fR permits, logs \f(CW$message\fR or \f(CW\*(C`sprintf($format, @args)\*(C'\fR
with the addition that \f(CW%m\fR in \f(CW$message\fR or \f(CW$format\fR is replaced with
\&\f(CW"$!"\fR (the latest error message).
.Sp
\&\f(CW$priority\fR can specify a level, or a level and a facility. Levels and
facilities can be given as strings or as macros. When using the \f(CW\*(C`eventlog\*(C'\fR
mechanism, priorities \f(CW\*(C`DEBUG\*(C'\fR and \f(CW\*(C`INFO\*(C'\fR are mapped to event type
\&\f(CW\*(C`informational\*(C'\fR, \f(CW\*(C`NOTICE\*(C'\fR and \f(CW\*(C`WARNING\*(C'\fR to \f(CW\*(C`warning\*(C'\fR and \f(CW\*(C`ERR\*(C'\fR to
\&\f(CW\*(C`EMERG\*(C'\fR to \f(CW\*(C`error\*(C'\fR.
.Sp
If you didn't use \f(CWopenlog()\fR before using \f(CWsyslog()\fR, \f(CWsyslog()\fR will
try to guess the \f(CW$ident\fR by extracting the shortest prefix of
\&\f(CW$format\fR that ends in a \f(CW":"\fR.
.Sp
\&\fBExamples\fR
.Sp
.Vb 3
\& # informational level
\& syslog("info", $message);
\& syslog(LOG_INFO, $message);
\&
\& # information level, Local0 facility
\& syslog("info|local0", $message);
\& syslog(LOG_INFO|LOG_LOCAL0, $message);
.Ve
.RS 4
.IP \fBNote\fR 4
.IX Item "Note"
\&\f(CW\*(C`Sys::Syslog\*(C'\fR version v0.07 and older passed the \f(CW$message\fR as the
formatting string to \f(CWsprintf()\fR even when no formatting arguments
were provided. If the code calling \f(CWsyslog()\fR might execute with
older versions of this module, make sure to call the function as
\&\f(CW\*(C`syslog($priority, "%s", $message)\*(C'\fR instead of \f(CW\*(C`syslog($priority,
$message)\*(C'\fR. This protects against hostile formatting sequences that
might show up if \f(CW$message\fR contains tainted data.
.RE
.RS 4
.RE
.IP \fBsetlogmask($mask_priority)\fR 4
.IX Item "setlogmask($mask_priority)"
Sets the log mask for the current process to \f(CW$mask_priority\fR and
returns the old mask. If the mask argument is 0, the current log mask
is not modified. See "Levels" for the list of available levels.
You can use the \f(CWLOG_UPTO()\fR function to allow all levels up to a
given priority (but it only accept the numeric macros as arguments).
.Sp
\&\fBExamples\fR
.Sp
Only log errors:
.Sp
.Vb 1
\& setlogmask( LOG_MASK(LOG_ERR) );
.Ve
.Sp
Log everything except informational messages:
.Sp
.Vb 1
\& setlogmask( ~(LOG_MASK(LOG_INFO)) );
.Ve
.Sp
Log critical messages, errors and warnings:
.Sp
.Vb 3
\& setlogmask( LOG_MASK(LOG_CRIT)
\& | LOG_MASK(LOG_ERR)
\& | LOG_MASK(LOG_WARNING) );
.Ve
.Sp
Log all messages up to debug:
.Sp
.Vb 1
\& setlogmask( LOG_UPTO(LOG_DEBUG) );
.Ve
.IP \fBsetlogsock()\fR 4
.IX Item "setlogsock()"
Sets the socket type and options to be used for the next call to \f(CWopenlog()\fR
or \f(CWsyslog()\fR. Returns true on success, \f(CW\*(C`undef\*(C'\fR on failure.
.Sp
Being Perl-specific, this function has evolved along time. It can currently
be called as follow:
.RS 4
.IP \(bu 4
\&\f(CWsetlogsock($sock_type)\fR
.IP \(bu 4
\&\f(CW\*(C`setlogsock($sock_type, $stream_location)\*(C'\fR (added in Perl 5.004_02)
.IP \(bu 4
\&\f(CW\*(C`setlogsock($sock_type, $stream_location, $sock_timeout)\*(C'\fR (added in
\&\f(CW\*(C`Sys::Syslog\*(C'\fR 0.25)
.IP \(bu 4
\&\f(CWsetlogsock(\e%options)\fR (added in \f(CW\*(C`Sys::Syslog\*(C'\fR 0.28)
.RE
.RS 4
.Sp
The available options are:
.IP \(bu 4
\&\f(CW\*(C`type\*(C'\fR \- equivalent to \f(CW$sock_type\fR, selects the socket type (or
"mechanism"). An array reference can be passed to specify several
mechanisms to try, in the given order.
.IP \(bu 4
\&\f(CW\*(C`path\*(C'\fR \- equivalent to \f(CW$stream_location\fR, sets the stream location.
Defaults to standard Unix location, or \f(CW\*(C`_PATH_LOG\*(C'\fR.
.IP \(bu 4
\&\f(CW\*(C`timeout\*(C'\fR \- equivalent to \f(CW$sock_timeout\fR, sets the socket timeout
in seconds. Defaults to 0 on all systems except Mac\ OS\ X where it
is set to 0.25 sec.
.IP \(bu 4
\&\f(CW\*(C`host\*(C'\fR \- sets the hostname to send the messages to. Defaults to
the local host.
.IP \(bu 4
\&\f(CW\*(C`port\*(C'\fR \- sets the TCP or UDP port to connect to. Defaults to the
first standard syslog port available on the system.
.RE
.RS 4
.Sp
The available mechanisms are:
.IP \(bu 4
\&\f(CW"native"\fR \- use the native C functions from your \f(CWsyslog(3)\fR library
(added in \f(CW\*(C`Sys::Syslog\*(C'\fR 0.15).
.IP \(bu 4
\&\f(CW"eventlog"\fR \- send messages to the Win32 events logger (Win32 only;
added in \f(CW\*(C`Sys::Syslog\*(C'\fR 0.19).
.IP \(bu 4
\&\f(CW"tcp"\fR \- connect to a TCP socket, on the \f(CW\*(C`syslog/tcp\*(C'\fR or \f(CW\*(C`syslogng/tcp\*(C'\fR
service. See also the \f(CW\*(C`host\*(C'\fR, \f(CW\*(C`port\*(C'\fR and \f(CW\*(C`timeout\*(C'\fR options.
.IP \(bu 4
\&\f(CW"udp"\fR \- connect to a UDP socket, on the \f(CW\*(C`syslog/udp\*(C'\fR service.
See also the \f(CW\*(C`host\*(C'\fR, \f(CW\*(C`port\*(C'\fR and \f(CW\*(C`timeout\*(C'\fR options.
.IP \(bu 4
\&\f(CW"inet"\fR \- connect to an INET socket, either TCP or UDP, tried in that
order. See also the \f(CW\*(C`host\*(C'\fR, \f(CW\*(C`port\*(C'\fR and \f(CW\*(C`timeout\*(C'\fR options.
.IP \(bu 4
\&\f(CW"unix"\fR \- connect to a UNIX domain socket (in some systems a character
special device). The name of that socket is given by the \f(CW\*(C`path\*(C'\fR option
or, if omitted, the value returned by the \f(CW\*(C`_PATH_LOG\*(C'\fR macro (if your
system defines it), \fI/dev/log\fR or \fI/dev/conslog\fR, whichever is writable.
.IP \(bu 4
\&\f(CW"stream"\fR \- connect to the stream indicated by the \f(CW\*(C`path\*(C'\fR option, or,
if omitted, the value returned by the \f(CW\*(C`_PATH_LOG\*(C'\fR macro (if your system
defines it), \fI/dev/log\fR or \fI/dev/conslog\fR, whichever is writable. For
example Solaris and IRIX system may prefer \f(CW"stream"\fR instead of \f(CW"unix"\fR.
.IP \(bu 4
\&\f(CW"pipe"\fR \- connect to the named pipe indicated by the \f(CW\*(C`path\*(C'\fR option,
or, if omitted, to the value returned by the \f(CW\*(C`_PATH_LOG\*(C'\fR macro (if your
system defines it), or \fI/dev/log\fR (added in \f(CW\*(C`Sys::Syslog\*(C'\fR 0.21).
HP-UX is a system which uses such a named pipe.
.IP \(bu 4
\&\f(CW"console"\fR \- send messages directly to the console, as for the \f(CW"cons"\fR
option of \f(CWopenlog()\fR.
.RE
.RS 4
.Sp
The default is to try \f(CW\*(C`native\*(C'\fR, \f(CW\*(C`tcp\*(C'\fR, \f(CW\*(C`udp\*(C'\fR, \f(CW\*(C`unix\*(C'\fR, \f(CW\*(C`pipe\*(C'\fR, \f(CW\*(C`stream\*(C'\fR,
\&\f(CW\*(C`console\*(C'\fR.
Under systems with the Win32 API, \f(CW\*(C`eventlog\*(C'\fR will be added as the first
mechanism to try if \f(CW\*(C`Win32::EventLog\*(C'\fR is available.
.Sp
Giving an invalid value for \f(CW$sock_type\fR will \f(CW\*(C`croak\*(C'\fR.
.Sp
\&\fBExamples\fR
.Sp
Select the UDP socket mechanism:
.Sp
.Vb 1
\& setlogsock("udp");
.Ve
.Sp
Send messages using the TCP socket mechanism on a custom port:
.Sp
.Vb 1
\& setlogsock({ type => "tcp", port => 2486 });
.Ve
.Sp
Send messages to a remote host using the TCP socket mechanism:
.Sp
.Vb 1
\& setlogsock({ type => "tcp", host => $loghost });
.Ve
.Sp
Try the native, UDP socket then UNIX domain socket mechanisms:
.Sp
.Vb 1
\& setlogsock(["native", "udp", "unix"]);
.Ve
.IP \fBNote\fR 4
.IX Item "Note"
Now that the "native" mechanism is supported by \f(CW\*(C`Sys::Syslog\*(C'\fR and selected
by default, the use of the \f(CWsetlogsock()\fR function is discouraged because
other mechanisms are less portable across operating systems. Authors of
modules and programs that use this function, especially its cargo-cult form
\&\f(CWsetlogsock("unix")\fR, are advised to remove any occurrence of it unless they
specifically want to use a given mechanism (like TCP or UDP to connect to
a remote host).
.RE
.RS 4
.RE
.IP \fBcloselog()\fR 4
.IX Item "closelog()"
Closes the log file and returns true on success.
.SH "THE RULES OF SYS::SYSLOG"
.IX Header "THE RULES OF SYS::SYSLOG"
\&\fIThe First Rule of Sys::Syslog is:\fR
You do not call \f(CW\*(C`setlogsock\*(C'\fR.
.PP
\&\fIThe Second Rule of Sys::Syslog is:\fR
You \fBdo not\fR call \f(CW\*(C`setlogsock\*(C'\fR.
.PP
\&\fIThe Third Rule of Sys::Syslog is:\fR
The program crashes, \f(CW\*(C`die\*(C'\fRs, calls \f(CW\*(C`closelog\*(C'\fR, the log is over.
.PP
\&\fIThe Fourth Rule of Sys::Syslog is:\fR
One facility, one priority.
.PP
\&\fIThe Fifth Rule of Sys::Syslog is:\fR
One log at a time.
.PP
\&\fIThe Sixth Rule of Sys::Syslog is:\fR
No \f(CW\*(C`syslog\*(C'\fR before \f(CW\*(C`openlog\*(C'\fR.
.PP
\&\fIThe Seventh Rule of Sys::Syslog is:\fR
Logs will go on as long as they have to.
.PP
\&\fIThe Eighth, and Final Rule of Sys::Syslog is:\fR
If this is your first use of Sys::Syslog, you must read the doc.
.SH EXAMPLES
.IX Header "EXAMPLES"
An example:
.PP
.Vb 4
\& openlog($program, \*(Aqcons,pid\*(Aq, \*(Aquser\*(Aq);
\& syslog(\*(Aqinfo\*(Aq, \*(Aq%s\*(Aq, \*(Aqthis is another test\*(Aq);
\& syslog(\*(Aqmail|warning\*(Aq, \*(Aqthis is a better test: %d\*(Aq, time);
\& closelog();
\&
\& syslog(\*(Aqdebug\*(Aq, \*(Aqthis is the last test\*(Aq);
.Ve
.PP
Another example:
.PP
.Vb 2
\& openlog("$program $$", \*(Aqndelay\*(Aq, \*(Aquser\*(Aq);
\& syslog(\*(Aqnotice\*(Aq, \*(Aqfooprogram: this is really done\*(Aq);
.Ve
.PP
Example of use of \f(CW%m\fR:
.PP
.Vb 2
\& $! = 55;
\& syslog(\*(Aqinfo\*(Aq, \*(Aqproblem was %m\*(Aq); # %m == $! in syslog(3)
.Ve
.PP
Log to UDP port on \f(CW$remotehost\fR instead of logging locally:
.PP
.Vb 3
\& setlogsock("udp", $remotehost);
\& openlog($program, \*(Aqndelay\*(Aq, \*(Aquser\*(Aq);
\& syslog(\*(Aqinfo\*(Aq, \*(Aqsomething happened over here\*(Aq);
.Ve
.SH CONSTANTS
.IX Header "CONSTANTS"
.SS Facilities
.IX Subsection "Facilities"
.IP \(bu 4
\&\f(CW\*(C`LOG_AUDIT\*(C'\fR \- audit daemon (IRIX); falls back to \f(CW\*(C`LOG_AUTH\*(C'\fR
.IP \(bu 4
\&\f(CW\*(C`LOG_AUTH\*(C'\fR \- security/authorization messages
.IP \(bu 4
\&\f(CW\*(C`LOG_AUTHPRIV\*(C'\fR \- security/authorization messages (private)
.IP \(bu 4
\&\f(CW\*(C`LOG_CONSOLE\*(C'\fR \- \f(CW\*(C`/dev/console\*(C'\fR output (FreeBSD); falls back to \f(CW\*(C`LOG_USER\*(C'\fR
.IP \(bu 4
\&\f(CW\*(C`LOG_CRON\*(C'\fR \- clock daemons (\fBcron\fR and \fBat\fR)
.IP \(bu 4
\&\f(CW\*(C`LOG_DAEMON\*(C'\fR \- system daemons without separate facility value
.IP \(bu 4
\&\f(CW\*(C`LOG_FTP\*(C'\fR \- FTP daemon
.IP \(bu 4
\&\f(CW\*(C`LOG_KERN\*(C'\fR \- kernel messages
.IP \(bu 4
\&\f(CW\*(C`LOG_INSTALL\*(C'\fR \- installer subsystem (Mac OS X); falls back to \f(CW\*(C`LOG_USER\*(C'\fR
.IP \(bu 4
\&\f(CW\*(C`LOG_LAUNCHD\*(C'\fR \- launchd \- general bootstrap daemon (Mac OS X);
falls back to \f(CW\*(C`LOG_DAEMON\*(C'\fR
.IP \(bu 4
\&\f(CW\*(C`LOG_LFMT\*(C'\fR \- logalert facility; falls back to \f(CW\*(C`LOG_USER\*(C'\fR
.IP \(bu 4
\&\f(CW\*(C`LOG_LOCAL0\*(C'\fR through \f(CW\*(C`LOG_LOCAL7\*(C'\fR \- reserved for local use
.IP \(bu 4
\&\f(CW\*(C`LOG_LPR\*(C'\fR \- line printer subsystem
.IP \(bu 4
\&\f(CW\*(C`LOG_MAIL\*(C'\fR \- mail subsystem
.IP \(bu 4
\&\f(CW\*(C`LOG_NETINFO\*(C'\fR \- NetInfo subsystem (Mac OS X); falls back to \f(CW\*(C`LOG_DAEMON\*(C'\fR
.IP \(bu 4
\&\f(CW\*(C`LOG_NEWS\*(C'\fR \- USENET news subsystem
.IP \(bu 4
\&\f(CW\*(C`LOG_NTP\*(C'\fR \- NTP subsystem (FreeBSD, NetBSD); falls back to \f(CW\*(C`LOG_DAEMON\*(C'\fR
.IP \(bu 4
\&\f(CW\*(C`LOG_RAS\*(C'\fR \- Remote Access Service (VPN / PPP) (Mac OS X);
falls back to \f(CW\*(C`LOG_AUTH\*(C'\fR
.IP \(bu 4
\&\f(CW\*(C`LOG_REMOTEAUTH\*(C'\fR \- remote authentication/authorization (Mac OS X);
falls back to \f(CW\*(C`LOG_AUTH\*(C'\fR
.IP \(bu 4
\&\f(CW\*(C`LOG_SECURITY\*(C'\fR \- security subsystems (firewalling, etc.) (FreeBSD);
falls back to \f(CW\*(C`LOG_AUTH\*(C'\fR
.IP \(bu 4
\&\f(CW\*(C`LOG_SYSLOG\*(C'\fR \- messages generated internally by \fBsyslogd\fR
.IP \(bu 4
\&\f(CW\*(C`LOG_USER\*(C'\fR (default) \- generic user-level messages
.IP \(bu 4
\&\f(CW\*(C`LOG_UUCP\*(C'\fR \- UUCP subsystem
.SS Levels
.IX Subsection "Levels"
.IP \(bu 4
\&\f(CW\*(C`LOG_EMERG\*(C'\fR \- system is unusable
.IP \(bu 4
\&\f(CW\*(C`LOG_ALERT\*(C'\fR \- action must be taken immediately
.IP \(bu 4
\&\f(CW\*(C`LOG_CRIT\*(C'\fR \- critical conditions
.IP \(bu 4
\&\f(CW\*(C`LOG_ERR\*(C'\fR \- error conditions
.IP \(bu 4
\&\f(CW\*(C`LOG_WARNING\*(C'\fR \- warning conditions
.IP \(bu 4
\&\f(CW\*(C`LOG_NOTICE\*(C'\fR \- normal, but significant, condition
.IP \(bu 4
\&\f(CW\*(C`LOG_INFO\*(C'\fR \- informational message
.IP \(bu 4
\&\f(CW\*(C`LOG_DEBUG\*(C'\fR \- debug-level message
.SH DIAGNOSTICS
.IX Header "DIAGNOSTICS"
.ie n .IP """Invalid argument passed to setlogsock""" 4
.el .IP "\f(CWInvalid argument passed to setlogsock\fR" 4
.IX Item "Invalid argument passed to setlogsock"
\&\fB(F)\fR You gave \f(CWsetlogsock()\fR an invalid value for \f(CW$sock_type\fR.
.ie n .IP """eventlog passed to setlogsock, but no Win32 API available""" 4
.el .IP "\f(CWeventlog passed to setlogsock, but no Win32 API available\fR" 4
.IX Item "eventlog passed to setlogsock, but no Win32 API available"
\&\fB(W)\fR You asked \f(CWsetlogsock()\fR to use the Win32 event logger but the
operating system running the program isn't Win32 or does not provides Win32
compatible facilities.
.ie n .IP """no connection to syslog available""" 4
.el .IP "\f(CWno connection to syslog available\fR" 4
.IX Item "no connection to syslog available"
\&\fB(F)\fR \f(CWsyslog()\fR failed to connect to the specified socket.
.ie n .IP """stream passed to setlogsock, but %s is not writable""" 4
.el .IP "\f(CWstream passed to setlogsock, but %s is not writable\fR" 4
.IX Item "stream passed to setlogsock, but %s is not writable"
\&\fB(W)\fR You asked \f(CWsetlogsock()\fR to use a stream socket, but the given
path is not writable.
.ie n .IP """stream passed to setlogsock, but could not find any device""" 4
.el .IP "\f(CWstream passed to setlogsock, but could not find any device\fR" 4
.IX Item "stream passed to setlogsock, but could not find any device"
\&\fB(W)\fR You asked \f(CWsetlogsock()\fR to use a stream socket, but didn't
provide a path, and \f(CW\*(C`Sys::Syslog\*(C'\fR was unable to find an appropriate one.
.ie n .IP """tcp passed to setlogsock, but tcp service unavailable""" 4
.el .IP "\f(CWtcp passed to setlogsock, but tcp service unavailable\fR" 4
.IX Item "tcp passed to setlogsock, but tcp service unavailable"
\&\fB(W)\fR You asked \f(CWsetlogsock()\fR to use a TCP socket, but the service
is not available on the system.
.ie n .IP """syslog: expecting argument %s""" 4
.el .IP "\f(CWsyslog: expecting argument %s\fR" 4
.IX Item "syslog: expecting argument %s"
\&\fB(F)\fR You forgot to give \f(CWsyslog()\fR the indicated argument.
.ie n .IP """syslog: invalid level/facility: %s""" 4
.el .IP "\f(CWsyslog: invalid level/facility: %s\fR" 4
.IX Item "syslog: invalid level/facility: %s"
\&\fB(F)\fR You specified an invalid level or facility.
.ie n .IP """syslog: too many levels given: %s""" 4
.el .IP "\f(CWsyslog: too many levels given: %s\fR" 4
.IX Item "syslog: too many levels given: %s"
\&\fB(F)\fR You specified too many levels.
.ie n .IP """syslog: too many facilities given: %s""" 4
.el .IP "\f(CWsyslog: too many facilities given: %s\fR" 4
.IX Item "syslog: too many facilities given: %s"
\&\fB(F)\fR You specified too many facilities.
.ie n .IP """syslog: level must be given""" 4
.el .IP "\f(CWsyslog: level must be given\fR" 4
.IX Item "syslog: level must be given"
\&\fB(F)\fR You forgot to specify a level.
.ie n .IP """udp passed to setlogsock, but udp service unavailable""" 4
.el .IP "\f(CWudp passed to setlogsock, but udp service unavailable\fR" 4
.IX Item "udp passed to setlogsock, but udp service unavailable"
\&\fB(W)\fR You asked \f(CWsetlogsock()\fR to use a UDP socket, but the service
is not available on the system.
.ie n .IP """unix passed to setlogsock, but path not available""" 4
.el .IP "\f(CWunix passed to setlogsock, but path not available\fR" 4
.IX Item "unix passed to setlogsock, but path not available"
\&\fB(W)\fR You asked \f(CWsetlogsock()\fR to use a UNIX socket, but \f(CW\*(C`Sys::Syslog\*(C'\fR
was unable to find an appropriate an appropriate device.
.SH HISTORY
.IX Header "HISTORY"
\&\f(CW\*(C`Sys::Syslog\*(C'\fR is a core module, part of the standard Perl distribution
since 1990. At this time, modules as we know them didn't exist, the
Perl library was a collection of \fI.pl\fR files, and the one for sending
syslog messages with was simply \fIlib/syslog.pl\fR, included with Perl 3.0.
It was converted as a module with Perl 5.0, but had a version number
only starting with Perl 5.6. Here is a small table with the matching
Perl and \f(CW\*(C`Sys::Syslog\*(C'\fR versions.
.PP
.Vb 10
\& Sys::Syslog Perl
\& \-\-\-\-\-\-\-\-\-\-\- \-\-\-\-
\& undef 5.0.0 ~ 5.5.4
\& 0.01 5.6.*
\& 0.03 5.8.0
\& 0.04 5.8.1, 5.8.2, 5.8.3
\& 0.05 5.8.4, 5.8.5, 5.8.6
\& 0.06 5.8.7
\& 0.13 5.8.8
\& 0.22 5.10.0
\& 0.27 5.8.9, 5.10.1 ~ 5.14.*
\& 0.29 5.16.*
\& 0.32 5.18.*
\& 0.33 5.20.*
\& 0.33 5.22.*
.Ve
.SH "SEE ALSO"
.IX Header "SEE ALSO"
.SS "Other modules"
.IX Subsection "Other modules"
Log::Log4perl \- Perl implementation of the Log4j API
.PP
Log::Dispatch \- Dispatches messages to one or more outputs
.PP
Log::Report \- Report a problem, with exceptions and language support
.SS "Manual Pages"
.IX Subsection "Manual Pages"
\&\fBsyslog\fR\|(3)
.PP
SUSv3 issue 6, IEEE Std 1003.1, 2004 edition,
<http://www.opengroup.org/onlinepubs/000095399/basedefs/syslog.h.html>
.PP
GNU C Library documentation on syslog,
<http://www.gnu.org/software/libc/manual/html_node/Syslog.html>
.PP
FreeBSD documentation on syslog,
<https://www.freebsd.org/cgi/man.cgi?query=syslog>
.PP
Solaris 11 documentation on syslog,
<https://docs.oracle.com/cd/E53394_01/html/E54766/syslog\-3c.html>
.PP
Mac OS X documentation on syslog,
<http://developer.apple.com/documentation/Darwin/Reference/ManPages/man3/syslog.3.html>
.PP
IRIX documentation on syslog,
<http://nixdoc.net/man\-pages/IRIX/man3/syslog.3c.html>
.PP
AIX 5L 5.3 documentation on syslog,
<http://publib.boulder.ibm.com/infocenter/pseries/v5r3/index.jsp?topic=/com.ibm.aix.basetechref/doc/basetrf2/syslog.htm>
.PP
HP-UX 11i documentation on syslog,
<http://docs.hp.com/en/B2355\-60130/syslog.3C.html>
.PP
Tru64 documentation on syslog,
<http://nixdoc.net/man\-pages/Tru64/man3/syslog.3.html>
.PP
Stratus VOS 15.1,
<http://stratadoc.stratus.com/vos/15.1.1/r502\-01/wwhelp/wwhimpl/js/html/wwhelp.htm?context=r502\-01&file=ch5r502\-01bi.html>
.SS RFCs
.IX Subsection "RFCs"
\&\fIRFC 3164 \- The BSD syslog Protocol\fR, <http://www.faqs.org/rfcs/rfc3164.html>
\&\-\- Please note that this is an informational RFC, and therefore does not
specify a standard of any kind.
.PP
\&\fIRFC 3195 \- Reliable Delivery for syslog\fR, <http://www.faqs.org/rfcs/rfc3195.html>
.SS Articles
.IX Subsection "Articles"
\&\fISyslogging with Perl\fR, <http://lexington.pm.org/meetings/022001.html>
.SS "Event Log"
.IX Subsection "Event Log"
Windows Event Log,
<http://msdn.microsoft.com/library/default.asp?url=/library/en\-us/wes/wes/windows_event_log.asp>
.SH "AUTHORS & ACKNOWLEDGEMENTS"
.IX Header "AUTHORS & ACKNOWLEDGEMENTS"
Tom Christiansen <\fItchrist (at) perl.com\fR> and Larry Wall
<\fIlarry (at) wall.org\fR>.
.PP
UNIX domain sockets added by Sean Robinson
<\fIrobinson_s (at) sc.maricopa.edu\fR> with support from Tim Bunce
<\fITim.Bunce (at) ig.co.uk\fR> and the \f(CW\*(C`perl5\-porters\*(C'\fR mailing list.
.PP
Dependency on \fIsyslog.ph\fR replaced with XS code by Tom Hughes
<\fItom (at) compton.nu\fR>.
.PP
Code for \f(CWconstant()\fRs regenerated by Nicholas Clark <\fInick (at) ccl4.org\fR>.
.PP
Failover to different communication modes by Nick Williams
<\fINick.Williams (at) morganstanley.com\fR>.
.PP
Extracted from core distribution for publishing on the CPAN by
Sébastien Aperghis-Tramoni <sebastien (at) aperghis.net>.
.PP
XS code for using native C functions borrowed from \f(CW\*(C`Unix::Syslog\*(C'\fR,
written by Marcus Harnisch <\fImarcus.harnisch (at) gmx.net\fR>.
.PP
Yves Orton suggested and helped for making \f(CW\*(C`Sys::Syslog\*(C'\fR use the native
event logger under Win32 systems.
.PP
Jerry D. Hedden and Reini Urban provided greatly appreciated help to
debug and polish \f(CW\*(C`Sys::Syslog\*(C'\fR under Cygwin.
.SH BUGS
.IX Header "BUGS"
Please report any bugs or feature requests to
\&\f(CW\*(C`bug\-sys\-syslog (at) rt.cpan.org\*(C'\fR, or through the web interface at
<http://rt.cpan.org/Public/Dist/Display.html?Name=Sys\-Syslog>.
I will be notified, and then you'll automatically be notified of progress on
your bug as I make changes.
.SH SUPPORT
.IX Header "SUPPORT"
You can find documentation for this module with the perldoc command.
.PP
.Vb 1
\& perldoc Sys::Syslog
.Ve
.PP
You can also look for information at:
.IP \(bu 4
Perl Documentation
.Sp
<http://perldoc.perl.org/Sys/Syslog.html>
.IP \(bu 4
MetaCPAN
.Sp
<https://metacpan.org/module/Sys::Syslog>
.IP \(bu 4
Search CPAN
.Sp
<http://search.cpan.org/dist/Sys\-Syslog/>
.IP \(bu 4
AnnoCPAN: Annotated CPAN documentation
.Sp
<http://annocpan.org/dist/Sys\-Syslog>
.IP \(bu 4
CPAN Ratings
.Sp
<http://cpanratings.perl.org/d/Sys\-Syslog>
.IP \(bu 4
RT: CPAN's request tracker
.Sp
<http://rt.cpan.org/Dist/Display.html?Queue=Sys\-Syslog>
.PP
The source code is available on Git Hub:
<https://github.com/maddingue/Sys\-Syslog/>
.SH COPYRIGHT
.IX Header "COPYRIGHT"
Copyright (C) 1990\-2012 by Larry Wall and others.
.SH LICENSE
.IX Header "LICENSE"
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
|