xref: /freebsd/usr.sbin/syslogd/syslog.conf.5 (revision 2eec1ab09100132b150572b9134de66b2bd71771)
1dea673e9SRodney W. Grimes.\" Copyright (c) 1990, 1991, 1993
2dea673e9SRodney W. Grimes.\"	The Regents of the University of California.  All rights reserved.
3dea673e9SRodney W. Grimes.\"
4dea673e9SRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without
5dea673e9SRodney W. Grimes.\" modification, are permitted provided that the following conditions
6dea673e9SRodney W. Grimes.\" are met:
7dea673e9SRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright
8dea673e9SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer.
9dea673e9SRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright
10dea673e9SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer in the
11dea673e9SRodney W. Grimes.\"    documentation and/or other materials provided with the distribution.
12dea673e9SRodney W. Grimes.\" 3. All advertising materials mentioning features or use of this software
13dea673e9SRodney W. Grimes.\"    must display the following acknowledgement:
14dea673e9SRodney W. Grimes.\"	This product includes software developed by the University of
15dea673e9SRodney W. Grimes.\"	California, Berkeley and its contributors.
16dea673e9SRodney W. Grimes.\" 4. Neither the name of the University nor the names of its contributors
17dea673e9SRodney W. Grimes.\"    may be used to endorse or promote products derived from this software
18dea673e9SRodney W. Grimes.\"    without specific prior written permission.
19dea673e9SRodney W. Grimes.\"
20dea673e9SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21dea673e9SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22dea673e9SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23dea673e9SRodney W. Grimes.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24dea673e9SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25dea673e9SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26dea673e9SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27dea673e9SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28dea673e9SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29dea673e9SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30dea673e9SRodney W. Grimes.\" SUCH DAMAGE.
31dea673e9SRodney W. Grimes.\"
32dea673e9SRodney W. Grimes.\"     @(#)syslog.conf.5	8.1 (Berkeley) 6/9/93
332eec1ab0SPoul-Henning Kamp.\"	$Id: syslog.conf.5,v 1.10 1998/06/10 04:34:54 julian Exp $
34dea673e9SRodney W. Grimes.\"
35dea673e9SRodney W. Grimes.Dd June 9, 1993
36dea673e9SRodney W. Grimes.Dt SYSLOG.CONF 5
37dea673e9SRodney W. Grimes.Os
38dea673e9SRodney W. Grimes.Sh NAME
39dea673e9SRodney W. Grimes.Nm syslog.conf
40dea673e9SRodney W. Grimes.Nd
41dea673e9SRodney W. Grimes.Xr syslogd 8
42dea673e9SRodney W. Grimesconfiguration file
43dea673e9SRodney W. Grimes.Sh DESCRIPTION
44dea673e9SRodney W. GrimesThe
4524685462SJohn-Mark Gurney.Nm
46dea673e9SRodney W. Grimesfile is the configuration file for the
47dea673e9SRodney W. Grimes.Xr syslogd 8
48dea673e9SRodney W. Grimesprogram.
49f8c034f9SJordan K. HubbardIt consists of
50f8c034f9SJordan K. Hubbardblocks of lines separated by
51f8c034f9SJordan K. Hubbard.Em program
52f8c034f9SJordan K. Hubbardspecifications,
53f8c034f9SJordan K. Hubbardwith each line containing two fields: the
54dea673e9SRodney W. Grimes.Em selector
55dea673e9SRodney W. Grimesfield which specifies the types of messages and priorities to which the
56dea673e9SRodney W. Grimesline applies, and an
57dea673e9SRodney W. Grimes.Em action
58dea673e9SRodney W. Grimesfield which specifies the action to be taken if a message
59dea673e9SRodney W. Grimes.Xr syslogd
60dea673e9SRodney W. Grimesreceives matches the selection criteria.
61dea673e9SRodney W. GrimesThe
62dea673e9SRodney W. Grimes.Em selector
63dea673e9SRodney W. Grimesfield is separated from the
64dea673e9SRodney W. Grimes.Em action
65dea673e9SRodney W. Grimesfield by one or more tab characters.
66dea673e9SRodney W. Grimes.Pp
67dea673e9SRodney W. GrimesThe
68dea673e9SRodney W. Grimes.Em Selectors
69dea673e9SRodney W. Grimesfunction
70dea673e9SRodney W. Grimesare encoded as a
71dea673e9SRodney W. Grimes.Em facility ,
7224685462SJohn-Mark Gurneya period
7324685462SJohn-Mark Gurney.Pq Dq \&. ,
742eec1ab0SPoul-Henning Kampan optional set of comparison flags
752eec1ab0SPoul-Henning Kamp.Pq Bq <=> ,
7624685462SJohn-Mark Gurneyand a
77dea673e9SRodney W. Grimes.Em level ,
78dea673e9SRodney W. Grimeswith no intervening white-space.
79dea673e9SRodney W. GrimesBoth the
80dea673e9SRodney W. Grimes.Em facility
81dea673e9SRodney W. Grimesand the
82dea673e9SRodney W. Grimes.Em level
83dea673e9SRodney W. Grimesare case insensitive.
84dea673e9SRodney W. Grimes.Pp
85dea673e9SRodney W. GrimesThe
86dea673e9SRodney W. Grimes.Em facility
87dea673e9SRodney W. Grimesdescribes the part of the system generating the message, and is one of
8824685462SJohn-Mark Gurneythe following keywords: auth, authpriv, cron, daemon, ftp, kern, lpr, mail,
89605efc87SJoerg Wunschmark, news, ntp, syslog, user, uucp and local0 through local7.
90dea673e9SRodney W. GrimesThese keywords (with the exception of mark) correspond to the
91dea673e9SRodney W. Grimessimilar
92dea673e9SRodney W. Grimes.Dq Dv LOG_
93dea673e9SRodney W. Grimesvalues specified to the
94dea673e9SRodney W. Grimes.Xr openlog 3
95dea673e9SRodney W. Grimesand
96dea673e9SRodney W. Grimes.Xr syslog 3
97dea673e9SRodney W. Grimeslibrary routines.
98dea673e9SRodney W. Grimes.Pp
99dea673e9SRodney W. GrimesThe
1002eec1ab0SPoul-Henning Kamp.Em comparison flags
1012eec1ab0SPoul-Henning Kampmay be used to specify exactly what is logged.
1022eec1ab0SPoul-Henning KampThe default set of comparison flags are
1032eec1ab0SPoul-Henning Kamp.Dq =>
1042eec1ab0SPoul-Henning Kamp(or, if you prefer,
1052eec1ab0SPoul-Henning Kamp.Do >=
1062eec1ab0SPoul-Henning Kamp.Dc ),
1072eec1ab0SPoul-Henning Kampwhich means that messages from the specified
1082eec1ab0SPoul-Henning Kamp.Em facility
1092eec1ab0SPoul-Henning Kamplist of a priority
1102eec1ab0SPoul-Henning Kamplevel equal or greater than
1112eec1ab0SPoul-Henning Kamp.Em level
1122eec1ab0SPoul-Henning Kampwill be logged.
1132eec1ab0SPoul-Henning Kamp.Pp
1142eec1ab0SPoul-Henning KampThe
115dea673e9SRodney W. Grimes.Em level
116dea673e9SRodney W. Grimesdescribes the severity of the message, and is a keyword from the
117dea673e9SRodney W. Grimesfollowing ordered list (higher to lower): emerg, alert, crit, err,
1183d08ec92SPaul Trainawarning, notice, info and debug.
119dea673e9SRodney W. GrimesThese keywords correspond to the
120dea673e9SRodney W. Grimessimilar
12124685462SJohn-Mark Gurney.Dq Dv LOG_
122dea673e9SRodney W. Grimesvalues specified to the
123dea673e9SRodney W. Grimes.Xr syslog
124dea673e9SRodney W. Grimeslibrary routine.
125dea673e9SRodney W. Grimes.Pp
126f8c034f9SJordan K. HubbardEach block of lines is separated from the previous block by a tag. The tag
127f8c034f9SJordan K. Hubbardis a line beginning with
128f8c034f9SJordan K. Hubbard.Em #!prog
129f8c034f9SJordan K. Hubbardor
130f8c034f9SJordan K. Hubbard.Em !prog
131f8c034f9SJordan K. Hubbard(the former is for compatibility with the previous syslogd, if one is sharing
132f8c034f9SJordan K. Hubbardsyslog.conf files, for example)
133f8c034f9SJordan K. Hubbardand each block will be associated with calls to syslog from that specific
134d2b4b1faSJulian Elischerprogram. A tag for ``foo'' will also match any message logged by the kernel
135d2b4b1faSJulian Elischerwith the prefix ``foo: ''.
136f8c034f9SJordan K. Hubbard.Pp
137dea673e9SRodney W. GrimesSee
138dea673e9SRodney W. Grimes.Xr syslog 3
139dea673e9SRodney W. Grimesfor a further descriptions of both the
140dea673e9SRodney W. Grimes.Em facility
141dea673e9SRodney W. Grimesand
142dea673e9SRodney W. Grimes.Em level
143f8c034f9SJordan K. Hubbardkeywords and their significance. It's preferred that selections be made on
144f8c034f9SJordan K. Hubbard.Em facility
145f8c034f9SJordan K. Hubbardrather than
146f8c034f9SJordan K. Hubbard.Em program ,
147f8c034f9SJordan K. Hubbardsince the latter can easily vary in a networked environment. In some cases,
148f8c034f9SJordan K. Hubbardthough, an appropriate
149f8c034f9SJordan K. Hubbard.Em facility
15024685462SJohn-Mark Gurneysimply doesn't exist.
151dea673e9SRodney W. Grimes.Pp
152dea673e9SRodney W. GrimesIf a received message matches the specified
153dea673e9SRodney W. Grimes.Em facility
154dea673e9SRodney W. Grimesand is of the specified
155dea673e9SRodney W. Grimes.Em level
156dea673e9SRodney W. Grimes.Em (or a higher level) ,
157f8c034f9SJordan K. Hubbardand the first word in the message after the date matches the
158f8c034f9SJordan K. Hubbard.Em program ,
159dea673e9SRodney W. Grimesthe action specified in the
160dea673e9SRodney W. Grimes.Em action
161dea673e9SRodney W. Grimesfield will be taken.
162dea673e9SRodney W. Grimes.Pp
163dea673e9SRodney W. GrimesMultiple
164dea673e9SRodney W. Grimes.Em selectors
165dea673e9SRodney W. Grimesmay be specified for a single
166dea673e9SRodney W. Grimes.Em action
16724685462SJohn-Mark Gurneyby separating them with semicolon
16824685462SJohn-Mark Gurney.Pq Dq \&;
16924685462SJohn-Mark Gurneycharacters.
170dea673e9SRodney W. GrimesIt is important to note, however, that each
171dea673e9SRodney W. Grimes.Em selector
172dea673e9SRodney W. Grimescan modify the ones preceding it.
173dea673e9SRodney W. Grimes.Pp
174dea673e9SRodney W. GrimesMultiple
175dea673e9SRodney W. Grimes.Em facilities
176dea673e9SRodney W. Grimesmay be specified for a single
177dea673e9SRodney W. Grimes.Em level
17824685462SJohn-Mark Gurneyby separating them with comma
17924685462SJohn-Mark Gurney.Pq Dq \&,
18024685462SJohn-Mark Gurneycharacters.
181dea673e9SRodney W. Grimes.Pp
18224685462SJohn-Mark GurneyAn asterisk
18324685462SJohn-Mark Gurney.Pq Dq *
18424685462SJohn-Mark Gurneycan be used to specify all
185dea673e9SRodney W. Grimes.Em facilities
186f8c034f9SJordan K. Hubbardall
187f8c034f9SJordan K. Hubbard.Em levels
188dea673e9SRodney W. Grimesor all
189f8c034f9SJordan K. Hubbard.Em programs .
190dea673e9SRodney W. Grimes.Pp
191dea673e9SRodney W. GrimesThe special
192dea673e9SRodney W. Grimes.Em facility
19324685462SJohn-Mark Gurney.Dq mark
19424685462SJohn-Mark Gurneyreceives a message at priority
19524685462SJohn-Mark Gurney.Dq info
19624685462SJohn-Mark Gurneyevery 20 minutes
197dea673e9SRodney W. Grimes(see
198dea673e9SRodney W. Grimes.Xr syslogd 8 ) .
199dea673e9SRodney W. GrimesThis is not enabled by a
200dea673e9SRodney W. Grimes.Em facility
201dea673e9SRodney W. Grimesfield containing an asterisk.
202dea673e9SRodney W. Grimes.Pp
203dea673e9SRodney W. GrimesThe special
204dea673e9SRodney W. Grimes.Em level
20524685462SJohn-Mark Gurney.Dq none
20624685462SJohn-Mark Gurneydisables a particular
207dea673e9SRodney W. Grimes.Em facility .
208dea673e9SRodney W. Grimes.Pp
209dea673e9SRodney W. GrimesThe
210dea673e9SRodney W. Grimes.Em action
211dea673e9SRodney W. Grimesfield of each line specifies the action to be taken when the
212dea673e9SRodney W. Grimes.Em selector
213dea673e9SRodney W. Grimesfield selects a message.
2145fadfc4cSJoerg WunschThere are five forms:
215dea673e9SRodney W. Grimes.Bl -bullet
216dea673e9SRodney W. Grimes.It
217dea673e9SRodney W. GrimesA pathname (beginning with a leading slash).
218dea673e9SRodney W. GrimesSelected messages are appended to the file.
219dea673e9SRodney W. Grimes.It
22024685462SJohn-Mark GurneyA hostname (preceded by an at
22124685462SJohn-Mark Gurney.Pq Dq @
22224685462SJohn-Mark Gurneysign).
223dea673e9SRodney W. GrimesSelected messages are forwarded to the
224dea673e9SRodney W. Grimes.Xr syslogd
225dea673e9SRodney W. Grimesprogram on the named host.
226dea673e9SRodney W. Grimes.It
227dea673e9SRodney W. GrimesA comma separated list of users.
228dea673e9SRodney W. GrimesSelected messages are written to those users
229dea673e9SRodney W. Grimesif they are logged in.
230dea673e9SRodney W. Grimes.It
231dea673e9SRodney W. GrimesAn asterisk.
232dea673e9SRodney W. GrimesSelected messages are written to all logged-in users.
2335fadfc4cSJoerg Wunsch.It
23424685462SJohn-Mark GurneyA vertical bar
23524685462SJohn-Mark Gurney.Pq Dq \&| ,
23624685462SJohn-Mark Gurneyfollowed by a command to pipe the selected
2375fadfc4cSJoerg Wunschmessages to.  The command is passed to a
2385fadfc4cSJoerg Wunsch.Pa /bin/sh
2395fadfc4cSJoerg Wunschfor evaluation, so usual shell metacharacters or input/output
2405fadfc4cSJoerg Wunschredirection can occur.  (Note however that redirecting
2415fadfc4cSJoerg Wunsch.Xr stdio 3
2425fadfc4cSJoerg Wunschbuffered output from the invoked command can cause additional delays,
2435fadfc4cSJoerg Wunschor even lost output data in case a logging subprocess exited with a
2445fadfc4cSJoerg Wunschsignal.)  The command itself runs with
2455fadfc4cSJoerg Wunsch.Em stdout
2465fadfc4cSJoerg Wunschand
2475fadfc4cSJoerg Wunsch.Em stderr
2485fadfc4cSJoerg Wunschredirected to
2495fadfc4cSJoerg Wunsch.Pa /dev/null .
2505fadfc4cSJoerg WunschUpon receipt of a
2515fadfc4cSJoerg Wunsch.Dv SIGHUP ,
25224685462SJohn-Mark Gurney.Nm
2535fadfc4cSJoerg Wunschwill close the pipe to the process.  If the process didn't exit
2547fa793ccSMike Pritchardvoluntarily, it will be sent a
2555fadfc4cSJoerg Wunsch.Dv SIGTERM
25681be6c75SJoerg Wunschsignal after a grace period of up to 60 seconds.
2575fadfc4cSJoerg Wunsch.Pp
2587fa793ccSMike PritchardThe command will only be started once data arrives that should be piped
25981be6c75SJoerg Wunschto it.  If it exited later, it will be restarted as necessary.  So if it
26081be6c75SJoerg Wunschis desired that the subprocess should get exactly one line of input only
26181be6c75SJoerg Wunsch(which can be very resource-consuming if there are a lot of messages
26281be6c75SJoerg Wunschflowing quickly), this can be achieved by exiting after just one line of
26381be6c75SJoerg Wunschinput.  If necessary, a script wrapper can be written to this effect.
2645fadfc4cSJoerg Wunsch.Pp
2655fadfc4cSJoerg WunschUnless the command is a full pipeline, it's probably useful to
2665fadfc4cSJoerg Wunschstart the command with
2675fadfc4cSJoerg Wunsch.Em exec
2685fadfc4cSJoerg Wunschso that the invoking shell process does not wait for the command to
2697fa793ccSMike Pritchardcomplete.  Warning: the process is started under the UID invoking
2705fadfc4cSJoerg Wunsch.Xr syslogd 8 ,
2717fa793ccSMike Pritchardnormally the superuser.
272dea673e9SRodney W. Grimes.El
273dea673e9SRodney W. Grimes.Pp
27424685462SJohn-Mark GurneyBlank lines and lines whose first non-blank character is a hash
27524685462SJohn-Mark Gurney.Pq Dq #
276dea673e9SRodney W. Grimescharacter are ignored.
277dea673e9SRodney W. Grimes.Sh EXAMPLES
278dea673e9SRodney W. Grimes.Pp
279dea673e9SRodney W. GrimesA configuration file might appear as follows:
280dea673e9SRodney W. Grimes.Bd -literal
281dea673e9SRodney W. Grimes# Log all kernel messages, authentication messages of
282dea673e9SRodney W. Grimes# level notice or higher and anything of level err or
283dea673e9SRodney W. Grimes# higher to the console.
284dea673e9SRodney W. Grimes# Don't log private authentication messages!
285dea673e9SRodney W. Grimes*.err;kern.*;auth.notice;authpriv.none	/dev/console
286dea673e9SRodney W. Grimes
287dea673e9SRodney W. Grimes# Log anything (except mail) of level info or higher.
288dea673e9SRodney W. Grimes# Don't log private authentication messages!
289dea673e9SRodney W. Grimes*.info;mail.none;authpriv.none		/var/log/messages
290dea673e9SRodney W. Grimes
2912eec1ab0SPoul-Henning Kamp# Log daemon messages at debug level only
2922eec1ab0SPoul-Henning Kampdaemon.=debug						/var/log/daemon.debug
2932eec1ab0SPoul-Henning Kamp
294dea673e9SRodney W. Grimes# The authpriv file has restricted access.
295dea673e9SRodney W. Grimesauthpriv.*						/var/log/secure
296dea673e9SRodney W. Grimes
297dea673e9SRodney W. Grimes# Log all the mail messages in one place.
298dea673e9SRodney W. Grimesmail.*							/var/log/maillog
299dea673e9SRodney W. Grimes
300dea673e9SRodney W. Grimes# Everybody gets emergency messages, plus log them on another
301dea673e9SRodney W. Grimes# machine.
302dea673e9SRodney W. Grimes*.emerg							*
303dea673e9SRodney W. Grimes*.emerg							@arpa.berkeley.edu
304dea673e9SRodney W. Grimes
305dea673e9SRodney W. Grimes# Root and Eric get alert and higher messages.
306dea673e9SRodney W. Grimes*.alert							root,eric
307dea673e9SRodney W. Grimes
308dea673e9SRodney W. Grimes# Save mail and news errors of level err and higher in a
309dea673e9SRodney W. Grimes# special file.
310dea673e9SRodney W. Grimesuucp,news.crit						/var/log/spoolerr
311f8c034f9SJordan K. Hubbard
3125fadfc4cSJoerg Wunsch# Pipe all authentication messages to a filter.
3135fadfc4cSJoerg Wunschauth.*					|exec /usr/local/sbin/authfilter
3145fadfc4cSJoerg Wunsch
315f8c034f9SJordan K. Hubbard# Save ftpd transactions along with mail and news
316f8c034f9SJordan K. Hubbard!ftpd
317f8c034f9SJordan K. Hubbard*.*							/var/log/spoolerr
318d2b4b1faSJulian Elischer
319d2b4b1faSJulian Elischer# Log kernel firewall reports to a separate file
320d2b4b1faSJulian Elischer!ipfw
321d2b4b1faSJulian Elischer*.*							/var/log/ipfw
322dea673e9SRodney W. Grimes.Ed
323dea673e9SRodney W. Grimes.Sh FILES
324dea673e9SRodney W. Grimes.Bl -tag -width /etc/syslog.conf -compact
325dea673e9SRodney W. Grimes.It Pa /etc/syslog.conf
326dea673e9SRodney W. Grimes.Xr syslogd 8
327b8b7e105SPhilippe Charnierconfiguration file
328dea673e9SRodney W. Grimes.El
329dea673e9SRodney W. Grimes.Sh BUGS
330dea673e9SRodney W. GrimesThe effects of multiple selectors are sometimes not intuitive.
33124685462SJohn-Mark GurneyFor example
33224685462SJohn-Mark Gurney.Dq mail.crit,*.err
33324685462SJohn-Mark Gurneywill select
33424685462SJohn-Mark Gurney.Dq mail
33524685462SJohn-Mark Gurneyfacility messages at the level of
33624685462SJohn-Mark Gurney.Dq err
33724685462SJohn-Mark Gurneyor higher, not at the level of
33824685462SJohn-Mark Gurney.Dq crit
33924685462SJohn-Mark Gurneyor higher.
340605efc87SJoerg Wunsch.Pp
341605efc87SJoerg WunschIn networked environments, note that not all operating systems
342605efc87SJoerg Wunschimplement the same set of facilities.  The facilities
343605efc87SJoerg Wunschauthpriv, cron, ftp, and ntp that are known to this implementation
344605efc87SJoerg Wunschmight be absent on the target system.  Even worse, DEC UNIX uses
345605efc87SJoerg Wunschfacility number 10 (which is authpriv in this implementation) to
346605efc87SJoerg Wunschlog events for their AdvFS file system.
347dea673e9SRodney W. Grimes.Sh SEE ALSO
348dea673e9SRodney W. Grimes.Xr syslog 3 ,
349dea673e9SRodney W. Grimes.Xr syslogd 8
350