1 .\" Written Feb 1994 by Steve Greenland (stevegr@neosoft.com)
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date. The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein. The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
25 .\" Updated 1999.12.19 by Karl M. Hegbloom <karlheg@debian.org>
27 .\" Updated 13 Oct 2001, Michael Kerrisk <mtk.manpages@gmail.com>
28 .\" Added description of vsyslog
29 .\" Added descriptions of LOG_ODELAY and LOG_NOWAIT
30 .\" Added brief description of facility and option arguments
31 .\" Added CONFORMING TO section
32 .\" 2001-10-13, aeb, minor changes
33 .\" Modified 13 Dec 2001, Martin Schulze <joey@infodrom.org>
34 .\" Modified 3 Jan 2002, Michael Kerrisk <mtk.manpages@gmail.com>
36 .TH SYSLOG 3 2012-08-17 "Linux" "Linux Programmer's Manual"
38 closelog, openlog, syslog, vsyslog \- send messages to the system logger
40 .B #include <syslog.h>
42 .BI "void openlog(const char *" ident ", int " option ", int " facility );
44 .BI "void syslog(int " priority ", const char *" format ", ...);"
46 .B "void closelog(void);"
48 .B #include <stdarg.h>
50 .BI "void vsyslog(int " priority ", const char *" format ", va_list " ap );
53 Feature Test Macro Requirements for glibc (see
54 .BR feature_test_macros (7)):
61 closes the descriptor being used to write to the system logger.
67 opens a connection to the system logger for a program.
68 The string pointed to by
70 is prepended to every message, and is typically set to the program name.
73 is NULL, the program name is used.
74 (POSIX.1-2008 does not specify the behavior when
80 argument specifies flags which control the operation of
82 and subsequent calls to
86 argument establishes a default to be used if
87 none is specified in subsequent calls to
96 is optional; it will automatically be called by
98 if necessary, in which case
100 will default to NULL.
103 generates a log message, which will be distributed by
107 argument is formed by ORing the
111 values (explained below).
112 The remaining arguments
117 and any arguments required by the
119 except that the two character sequence
122 the error message string
123 .IR strerror ( errno ).
124 A trailing newline may be added if needed.
128 performs the same task as
130 with the difference that it takes a set of arguments which have
131 been obtained using the
133 variable argument list macros.
135 The subsections below list the parameters used to set the values of
136 .IR option , " facility" ", and " priority .
142 is an OR of any of these:
145 Write directly to system console if there is an error while sending to
149 Open the connection immediately (normally, the connection is opened when
150 the first message is logged).
153 Don't wait for child processes that may have been created while logging
155 (The GNU C library does not create a child process, so this
156 option has no effect on Linux.)
161 opening of the connection is delayed until
164 (This is the default, and need not be specified.)
167 (Not in POSIX.1-2001 or POSIX.1-2008.)
168 Print to \fIstderr\fP as well.
171 Include PID with each message.
175 argument is used to specify what type of program is logging the message.
176 This lets the configuration file specify that messages from different
177 facilities will be handled differently.
180 security/authorization messages
183 security/authorization messages (private)
187 .RB ( cron " and " at )
190 system daemons without separate facility value
196 kernel messages (these can't be generated from user processes)
197 .\" LOG_KERN has the value 0; if used as a facility, zero translates to:
198 .\" "use the default facility".
200 .BR LOG_LOCAL0 " through " LOG_LOCAL7
201 reserved for local use
204 line printer subsystem
210 USENET news subsystem
213 messages generated internally by
216 .BR LOG_USER " (default)"
217 generic user-level messages
222 This determines the importance of the message.
223 The levels are, in order of decreasing importance:
229 action must be taken immediately
241 normal, but significant, condition
244 informational message
251 can be used to restrict logging to specified levels only.
260 are specified in SUSv2, POSIX.1-2001, and POSIX.1-2008.
261 POSIX.1-2001 specifies only the
267 However, with the exception of
273 values appear on most UNIX systems.
278 is not specified by POSIX.1-2001 or POSIX.1-2008, but is available
279 in most versions of UNIX.
283 .\" function call appeared in 4.2BSD.
289 .\" .BR setlogmask ().
290 .\" 4.3BSD-Reno also documents
292 .\" Of course early v* functions used the
294 .\" mechanism, which is not compatible with
301 is probably stored as-is.
302 Thus, if the string it points to
305 may start prepending the changed string, and if the string
306 it points to ceases to exist, the results are undefined.
307 Most portable is to use a string constant.
309 Never pass a string with user-supplied data as a format,
310 use the following instead:
313 syslog(priority, "%s", string);
321 This page is part of release 3.68 of the Linux
324 A description of the project,
325 information about reporting bugs,
326 and the latest version of this page,
328 \%http://www.kernel.org/doc/man\-pages/.