[9] | 1 | .\" Written Feb 1994 by Steve Greenland (stevegr@neosoft.com)
|
---|
| 2 | .\"
|
---|
| 3 | .\" Permission is granted to make and distribute verbatim copies of this
|
---|
| 4 | .\" manual provided the copyright notice and this permission notice are
|
---|
| 5 | .\" preserved on all copies.
|
---|
| 6 | .\"
|
---|
| 7 | .\" Permission is granted to copy and distribute modified versions of this
|
---|
| 8 | .\" manual under the conditions for verbatim copying, provided that the
|
---|
| 9 | .\" entire resulting derived work is distributed under the terms of a
|
---|
| 10 | .\" permission notice identical to this one
|
---|
| 11 | .\"
|
---|
| 12 | .\" Since the Linux kernel and libraries are constantly changing, this
|
---|
| 13 | .\" manual page may be incorrect or out-of-date. The author(s) assume no
|
---|
| 14 | .\" responsibility for errors or omissions, or for damages resulting from
|
---|
| 15 | .\" the use of the information contained herein. The author(s) may not
|
---|
| 16 | .\" have taken the same level of care in the production of this manual,
|
---|
| 17 | .\" which is licensed free of charge, as they might when working
|
---|
| 18 | .\" professionally.
|
---|
| 19 | .\"
|
---|
| 20 | .\" Formatted or processed versions of this manual, if unaccompanied by
|
---|
| 21 | .\" the source, must acknowledge the copyright and authors of this work.
|
---|
| 22 | .\"
|
---|
| 23 | .\" from SYSLOG 3 "15 Feb 1994" "Linux" "Linux Programmer's Manual"
|
---|
| 24 | .\" Modified for Minix porting by G. Falzoni <gfalzoni@inwind.it>
|
---|
| 25 | .\" $Id: syslog.3,v 1.1 2006/04/03 14:59:51 beng Exp $
|
---|
| 26 | .\"
|
---|
| 27 | .\" Local macros
|
---|
| 28 | .de Xr
|
---|
| 29 | .BR \\$1 (\\$2)\\$3
|
---|
| 30 | ..
|
---|
| 31 | .de LB
|
---|
| 32 | .TP \\$1
|
---|
| 33 | \\fB\\$2\\fR
|
---|
| 34 | \\$3
|
---|
| 35 | ..
|
---|
| 36 | .de LI
|
---|
| 37 | .TP \\$1
|
---|
| 38 | \\fI\\$2\\fR
|
---|
| 39 | \\$3
|
---|
| 40 | ..
|
---|
| 41 | .de LR
|
---|
| 42 | .TP \\$1
|
---|
| 43 | \\fR\\$2\\fR
|
---|
| 44 | \\$3
|
---|
| 45 | ..
|
---|
| 46 | .\" end local macros
|
---|
| 47 | .TH SYSLOG 3 "Jan. 18, 2000"
|
---|
| 48 | .SH NAME
|
---|
| 49 | openlog, syslog, closelog \- send messages to the system logger
|
---|
| 50 | .SH SYNOPSIS
|
---|
| 51 | .B #include <syslog.h>
|
---|
| 52 | .sp
|
---|
| 53 | .BI "void openlog(char " *ident ", int " option ", int " facility)
|
---|
| 54 | .sp
|
---|
| 55 | .BI "void syslog(int " priority ", char " *format ", ...)"
|
---|
| 56 | .sp
|
---|
| 57 | .BI "void closelog(void)"
|
---|
| 58 | .sp
|
---|
| 59 | .SH DESCRIPTION
|
---|
| 60 | .B openlog()
|
---|
| 61 | opens a connection to the system logger for a program. The string pointed to by
|
---|
| 62 | .I ident
|
---|
| 63 | is added to each message, and is typically set to the program name. Values for
|
---|
| 64 | .I option
|
---|
| 65 | and
|
---|
| 66 | .I facility
|
---|
| 67 | are given in the next section. Its use is optional. It will automatically be called by
|
---|
| 68 | .B syslog()
|
---|
| 69 | if necessary, in which case
|
---|
| 70 | .I ident
|
---|
| 71 | will default to "syslog".
|
---|
| 72 | .sp
|
---|
| 73 | .B syslog()
|
---|
| 74 | generates a log message, which will be distributed by
|
---|
| 75 | .Xr syslogd 8 .
|
---|
| 76 | .I priority
|
---|
| 77 | is a combination of the
|
---|
| 78 | .I facility
|
---|
| 79 | and the
|
---|
| 80 | .IR level ,
|
---|
| 81 | values for which are given in the next section. The remaining arguments
|
---|
| 82 | are a
|
---|
| 83 | .IR format ,
|
---|
| 84 | as in
|
---|
| 85 | .Xr printf 3
|
---|
| 86 | and any arguments required by the
|
---|
| 87 | .IR format .
|
---|
| 88 | .\" except that the two character %m will be replaced by the error message string
|
---|
| 89 | .\" RI ( strerror )
|
---|
| 90 | .\" corresponding to the present value of
|
---|
| 91 | .\" IR errno .
|
---|
| 92 | .sp
|
---|
| 93 | .B closelog()
|
---|
| 94 | closes the descriptor being used to write to the system logger. Its use is optional.
|
---|
| 95 | .SH "PARAMETERS"
|
---|
| 96 | This section lists the parameters used to set the values of
|
---|
| 97 | .IR option , " facility" ", and " priority .
|
---|
| 98 | .SS option
|
---|
| 99 | The
|
---|
| 100 | .I option
|
---|
| 101 | argument to
|
---|
| 102 | .B openlog()
|
---|
| 103 | is an OR of any of these:
|
---|
| 104 | .TP
|
---|
| 105 | .B LOG_CONS
|
---|
| 106 | write directly to system console if there is an error while sending to
|
---|
| 107 | system logger
|
---|
| 108 | .TP
|
---|
| 109 | .B LOG_NDELAY
|
---|
| 110 | open the connection immediately (normally, the connection is opened when
|
---|
| 111 | the first message is logged)
|
---|
| 112 | .TP
|
---|
| 113 | .B LOG_PERROR
|
---|
| 114 | print to stderr as well
|
---|
| 115 | .TP
|
---|
| 116 | .B LOG_PID
|
---|
| 117 | include PID with each message
|
---|
| 118 | .SS facility
|
---|
| 119 | The
|
---|
| 120 | .I facility
|
---|
| 121 | argument is used to specify what type of program is logging the message.
|
---|
| 122 | This lets the configuration file specify that messages from different
|
---|
| 123 | facilities will be handled differently.
|
---|
| 124 | .TP
|
---|
| 125 | .B LOG_AUTH
|
---|
| 126 | security/authorization messages (DEPRECATED Use
|
---|
| 127 | .B LOG_AUTHPRIV
|
---|
| 128 | instead)
|
---|
| 129 | .TP
|
---|
| 130 | .B LOG_AUTHPRIV
|
---|
| 131 | security/authorization messages (private)
|
---|
| 132 | .TP
|
---|
| 133 | .B LOG_CRON
|
---|
| 134 | clock daemon
|
---|
| 135 | .RB ( cron " and " at )
|
---|
| 136 | .TP
|
---|
| 137 | .B LOG_DAEMON
|
---|
| 138 | other system daemons
|
---|
| 139 | .TP
|
---|
| 140 | .B LOG_KERN
|
---|
| 141 | kernel messages
|
---|
| 142 | .TP
|
---|
| 143 | .BR LOG_LOCAL0 " through " LOG_LOCAL7
|
---|
| 144 | reserved for local use
|
---|
| 145 | .TP
|
---|
| 146 | .B LOG_LPR
|
---|
| 147 | line printer subsystem
|
---|
| 148 | .TP
|
---|
| 149 | .B LOG_MAIL
|
---|
| 150 | mail subsystem
|
---|
| 151 | .TP
|
---|
| 152 | .B LOG_NEWS
|
---|
| 153 | USENET news subsystem
|
---|
| 154 | .TP
|
---|
| 155 | .B LOG_SYSLOG
|
---|
| 156 | messages generated internally by
|
---|
| 157 | .B syslogd
|
---|
| 158 | .TP
|
---|
| 159 | .BR LOG_USER (default)
|
---|
| 160 | generic user-level messages
|
---|
| 161 | .TP
|
---|
| 162 | .B LOG_UUCP
|
---|
| 163 | UUCP subsystem
|
---|
| 164 | .SS level
|
---|
| 165 | This determines the importance of the message. The levels are, in order
|
---|
| 166 | of decreasing importance:
|
---|
| 167 | .TP
|
---|
| 168 | .B LOG_EMERG
|
---|
| 169 | system is unusable
|
---|
| 170 | .TP
|
---|
| 171 | .B LOG_ALERT
|
---|
| 172 | action must be taken immediately
|
---|
| 173 | .TP
|
---|
| 174 | .B LOG_CRIT
|
---|
| 175 | critical conditions
|
---|
| 176 | .TP
|
---|
| 177 | .B LOG_ERR
|
---|
| 178 | error conditions
|
---|
| 179 | .TP
|
---|
| 180 | .B LOG_WARNING
|
---|
| 181 | warning conditions
|
---|
| 182 | .TP
|
---|
| 183 | .B LOG_NOTICE
|
---|
| 184 | normal, but significant, condition
|
---|
| 185 | .TP
|
---|
| 186 | .B LOG_INFO
|
---|
| 187 | informational message
|
---|
| 188 | .TP
|
---|
| 189 | .B LOG_DEBUG
|
---|
| 190 | debug-level message
|
---|
| 191 | .SH HISTORY
|
---|
| 192 | A
|
---|
| 193 | .B syslog
|
---|
| 194 | function call appeared in BSD 4.2.
|
---|
| 195 | .SH SEE ALSO
|
---|
| 196 | .Xr logger 1 ,
|
---|
| 197 | .Xr syslog.conf 5 ,
|
---|
| 198 | .Xr syslogd 8 .
|
---|