199 lines
4.5 KiB
Groff
199 lines
4.5 KiB
Groff
|
.\" Written Feb 1994 by Steve Greenland (stevegr@neosoft.com)
|
||
|
.\"
|
||
|
.\" Permission is granted to make and distribute verbatim copies of this
|
||
|
.\" manual provided the copyright notice and this permission notice are
|
||
|
.\" preserved on all copies.
|
||
|
.\"
|
||
|
.\" Permission is granted to copy and distribute modified versions of this
|
||
|
.\" manual under the conditions for verbatim copying, provided that the
|
||
|
.\" entire resulting derived work is distributed under the terms of a
|
||
|
.\" permission notice identical to this one
|
||
|
.\"
|
||
|
.\" Since the Linux kernel and libraries are constantly changing, this
|
||
|
.\" manual page may be incorrect or out-of-date. The author(s) assume no
|
||
|
.\" responsibility for errors or omissions, or for damages resulting from
|
||
|
.\" the use of the information contained herein. The author(s) may not
|
||
|
.\" have taken the same level of care in the production of this manual,
|
||
|
.\" which is licensed free of charge, as they might when working
|
||
|
.\" professionally.
|
||
|
.\"
|
||
|
.\" Formatted or processed versions of this manual, if unaccompanied by
|
||
|
.\" the source, must acknowledge the copyright and authors of this work.
|
||
|
.\"
|
||
|
.\" from SYSLOG 3 "15 Feb 1994" "Linux" "Linux Programmer's Manual"
|
||
|
.\" Modified for Minix porting by G. Falzoni <gfalzoni@inwind.it>
|
||
|
.\" $Id$
|
||
|
.\"
|
||
|
.\" Local macros
|
||
|
.de Xr
|
||
|
.BR \\$1 (\\$2)\\$3
|
||
|
..
|
||
|
.de LB
|
||
|
.TP \\$1
|
||
|
\\fB\\$2\\fR
|
||
|
\\$3
|
||
|
..
|
||
|
.de LI
|
||
|
.TP \\$1
|
||
|
\\fI\\$2\\fR
|
||
|
\\$3
|
||
|
..
|
||
|
.de LR
|
||
|
.TP \\$1
|
||
|
\\fR\\$2\\fR
|
||
|
\\$3
|
||
|
..
|
||
|
.\" end local macros
|
||
|
.TH SYSLOG 3 "Jan. 18, 2000"
|
||
|
.SH NAME
|
||
|
openlog, syslog, closelog \- send messages to the system logger
|
||
|
.SH SYNOPSIS
|
||
|
.B #include <syslog.h>
|
||
|
.sp
|
||
|
.BI "void openlog(char " *ident ", int " option ", int " facility)
|
||
|
.sp
|
||
|
.BI "void syslog(int " priority ", char " *format ", ...)"
|
||
|
.sp
|
||
|
.BI "void closelog(void)"
|
||
|
.sp
|
||
|
.SH DESCRIPTION
|
||
|
.B openlog()
|
||
|
opens a connection to the system logger for a program. The string pointed to by
|
||
|
.I ident
|
||
|
is added to each message, and is typically set to the program name. Values for
|
||
|
.I option
|
||
|
and
|
||
|
.I facility
|
||
|
are given in the next section. Its use is optional. It will automatically be called by
|
||
|
.B syslog()
|
||
|
if necessary, in which case
|
||
|
.I ident
|
||
|
will default to "syslog".
|
||
|
.sp
|
||
|
.B syslog()
|
||
|
generates a log message, which will be distributed by
|
||
|
.Xr syslogd 8 .
|
||
|
.I priority
|
||
|
is a combination of the
|
||
|
.I facility
|
||
|
and the
|
||
|
.IR level ,
|
||
|
values for which are given in the next section. The remaining arguments
|
||
|
are a
|
||
|
.IR format ,
|
||
|
as in
|
||
|
.Xr printf 3
|
||
|
and any arguments required by the
|
||
|
.IR format .
|
||
|
.\" except that the two character %m will be replaced by the error message string
|
||
|
.\" RI ( strerror )
|
||
|
.\" corresponding to the present value of
|
||
|
.\" IR errno .
|
||
|
.sp
|
||
|
.B closelog()
|
||
|
closes the descriptor being used to write to the system logger. Its use is optional.
|
||
|
.SH "PARAMETERS"
|
||
|
This section lists the parameters used to set the values of
|
||
|
.IR option , " facility" ", and " priority .
|
||
|
.SS option
|
||
|
The
|
||
|
.I option
|
||
|
argument to
|
||
|
.B openlog()
|
||
|
is an OR of any of these:
|
||
|
.TP
|
||
|
.B LOG_CONS
|
||
|
write directly to system console if there is an error while sending to
|
||
|
system logger
|
||
|
.TP
|
||
|
.B LOG_NDELAY
|
||
|
open the connection immediately (normally, the connection is opened when
|
||
|
the first message is logged)
|
||
|
.TP
|
||
|
.B LOG_PERROR
|
||
|
print to stderr as well
|
||
|
.TP
|
||
|
.B LOG_PID
|
||
|
include PID with each message
|
||
|
.SS facility
|
||
|
The
|
||
|
.I facility
|
||
|
argument is used to specify what type of program is logging the message.
|
||
|
This lets the configuration file specify that messages from different
|
||
|
facilities will be handled differently.
|
||
|
.TP
|
||
|
.B LOG_AUTH
|
||
|
security/authorization messages (DEPRECATED Use
|
||
|
.B LOG_AUTHPRIV
|
||
|
instead)
|
||
|
.TP
|
||
|
.B LOG_AUTHPRIV
|
||
|
security/authorization messages (private)
|
||
|
.TP
|
||
|
.B LOG_CRON
|
||
|
clock daemon
|
||
|
.RB ( cron " and " at )
|
||
|
.TP
|
||
|
.B LOG_DAEMON
|
||
|
other system daemons
|
||
|
.TP
|
||
|
.B LOG_KERN
|
||
|
kernel messages
|
||
|
.TP
|
||
|
.BR LOG_LOCAL0 " through " LOG_LOCAL7
|
||
|
reserved for local use
|
||
|
.TP
|
||
|
.B LOG_LPR
|
||
|
line printer subsystem
|
||
|
.TP
|
||
|
.B LOG_MAIL
|
||
|
mail subsystem
|
||
|
.TP
|
||
|
.B LOG_NEWS
|
||
|
USENET news subsystem
|
||
|
.TP
|
||
|
.B LOG_SYSLOG
|
||
|
messages generated internally by
|
||
|
.B syslogd
|
||
|
.TP
|
||
|
.BR LOG_USER (default)
|
||
|
generic user-level messages
|
||
|
.TP
|
||
|
.B LOG_UUCP
|
||
|
UUCP subsystem
|
||
|
.SS level
|
||
|
This determines the importance of the message. The levels are, in order
|
||
|
of decreasing importance:
|
||
|
.TP
|
||
|
.B LOG_EMERG
|
||
|
system is unusable
|
||
|
.TP
|
||
|
.B LOG_ALERT
|
||
|
action must be taken immediately
|
||
|
.TP
|
||
|
.B LOG_CRIT
|
||
|
critical conditions
|
||
|
.TP
|
||
|
.B LOG_ERR
|
||
|
error conditions
|
||
|
.TP
|
||
|
.B LOG_WARNING
|
||
|
warning conditions
|
||
|
.TP
|
||
|
.B LOG_NOTICE
|
||
|
normal, but significant, condition
|
||
|
.TP
|
||
|
.B LOG_INFO
|
||
|
informational message
|
||
|
.TP
|
||
|
.B LOG_DEBUG
|
||
|
debug-level message
|
||
|
.SH HISTORY
|
||
|
A
|
||
|
.B syslog
|
||
|
function call appeared in BSD 4.2.
|
||
|
.SH SEE ALSO
|
||
|
.Xr logger 1 ,
|
||
|
.Xr syslog.conf 5 ,
|
||
|
.Xr syslogd 8 .
|