1SYSLOG.CONF(5) Linux System Administration SYSLOG.CONF(5)
2
3
4
6 syslog.conf - syslogd(8) configuration file
7
9 The syslog.conf file is the main configuration file for the syslogd(8)
10 which logs system messages on *nix systems. This file specifies rules
11 for logging. For special features see the sysklogd(8) manpage.
12
13 Every rule consists of two fields, a selector field and an action
14 field. These two fields are separated by one or more spaces or tabs.
15 The selector field specifies a pattern of facilities and priorities
16 belonging to the specified action.
17
18 Lines starting with a hash mark (``#'') and empty lines are ignored.
19
20 This release of syslogd is able to understand an extended syntax. One
21 rule can be divided into several lines if the leading line is termi‐
22 nated with an backslash (``\'').
23
25 The selector field itself again consists of two parts, a facility and a
26 priority, separated by a period (``.''). Both parts are case insensi‐
27 tive and can also be specified as decimal numbers, but don't do that,
28 you have been warned. Both facilities and priorities are described in
29 syslog(3). The names mentioned below correspond to the similar
30 LOG_-values in /usr/include/syslog.h.
31
32 The facility is one of the following keywords: auth, authpriv, cron,
33 daemon, ftp, kern, lpr, mail, mark, news, security (same as auth), sys‐
34 log, user, uucp and local0 through local7. The keyword security should
35 not be used anymore and mark is only for internal use and therefore
36 should not be used in applications. Anyway, you may want to specify
37 and redirect these messages here. The facility specifies the subsystem
38 that produced the message, i.e. all mail programs log with the mail
39 facility (LOG_MAIL) if they log using syslog.
40
41 In most cases anyone can log to any facility, so we rely on convention
42 for the correct facility to be chosen. However, generally only the
43 kernel can log to the "kern" facility. This is because the implementa‐
44 tion of openlog() and syslog() in glibc does not allow logging to the
45 "kern" facility. Klogd circumvents this restriction when logging to
46 syslogd by reimplementing those functions itself.
47
48 The priority is one of the following keywords, in ascending order:
49 debug, info, notice, warning, warn (same as warning), err, error (same
50 as err), crit, alert, emerg, panic (same as emerg). The keywords warn,
51 error and panic are deprecated and should not be used anymore. The
52 priority defines the severity of the message
53
54 The behavior of the original BSD syslogd is that all messages of the
55 specified priority and higher are logged according to the given action.
56 This syslogd(8) behaves the same, but has some extensions.
57
58 In addition to the above mentioned names the syslogd(8) understands the
59 following extensions: An asterisk (``*'') stands for all facilities or
60 all priorities, depending on where it is used (before or after the
61 period). The keyword none stands for no priority of the given facil‐
62 ity.
63
64 You can specify multiple facilities with the same priority pattern in
65 one statement using the comma (``,'') operator. You may specify as
66 many facilities as you want. Please note that only the facility part
67 from such a statement is taken, a priority part would be skipped.
68
69 Multiple selectors may be specified for a single action using the semi‐
70 colon (``;'') separator. Please note that each selector in the selec‐
71 tor field is capable of overwriting the preceding ones. Using this
72 behavior you can exclude some priorities from the pattern.
73
74 This syslogd(8) has a syntax extension to the original BSD source,
75 which makes its use more intuitive. You may precede every priority
76 with an equation sign (``='') to specify that syslogd should only refer
77 to this single priority and not this priority and all higher priori‐
78 ties.
79
80 You may also precide the priority with an exclamation mark (``!'') if
81 you want syslogd to ignore this priority and all higher priorities.
82 You may even use both, the exclamation mark and the equation sign if
83 you want syslogd to ignore only this single priority. If you use both
84 extensions than the exclamation mark must occur before the equation
85 sign, just use it intuitively.
86
88 The action field of a rule describes the abstract term ``logfile''. A
89 ``logfile'' need not to be a real file, btw. The syslogd(8) provides
90 the following actions.
91
92
93 Regular File
94 Typically messages are logged to real files. The file has to be speci‐
95 fied with full pathname, beginning with a slash ``/''.
96
97 You may prefix each entry with the minus ``-'' sign to omit syncing the
98 file after every logging. Note that you might lose information if the
99 system crashes right behind a write attempt. Nevertheless this might
100 give you back some performance, especially if you run programs that use
101 logging in a very verbose manner.
102
103
104 Named Pipes
105 This version of syslogd(8) has support for logging output to named
106 pipes (fifos). A fifo or named pipe can be used as a destination for
107 log messages by prepending a pipe symbol (``|'') to the name of the
108 file. This is handy for debugging. Note that the fifo must be created
109 with the mkfifo(1) command before syslogd(8) is started.
110
111
112 Terminal and Console
113 If the file you specified is a tty, special tty-handling is done, same
114 with /dev/console.
115
116
117 Remote Machine
118 This syslogd(8) provides full remote logging, i.e. is able to send mes‐
119 sages to a remote host running syslogd(8) and to receive messages from
120 remote hosts. The remote host won't forward the message again, it will
121 just log them locally. To forward messages to another host, prepend
122 the hostname with the at sign (``@'').
123
124 Using this feature you're able to control all syslog messages on one
125 host, if all other machines will log remotely to that. This tears down
126 administration needs.
127
128
129 List of Users
130 Usually critical messages are also directed to ``root'' on that
131 machine. You can specify a list of users that shall get the message by
132 simply writing the username. You may specify more than one user by
133 separating the usernames with commas (``,''). If they're logged in
134 they will receive the log messages.
135
136
137 Everyone logged on
138 Emergency messages often go to all users currently online to notify
139 them that something strange is happening with the system. To specify
140 this wall(1)-feature use an asterisk (``*'').
141
143 Here are some example, partially taken from a real existing site and
144 configuration. Hopefully they rub out all questions on the configura‐
145 tion, if not, drop me (Joey) a line.
146
147 # Store critical stuff in critical
148 #
149 *.=crit;kern.none /var/adm/critical
150
151 This will store all messages with the priority crit in the file
152 /var/adm/critical, except for any kernel message.
153
154
155 # Kernel messages are first, stored in the kernel
156 # file, critical messages and higher ones also go
157 # to another host and to the console
158 #
159 kern.* /var/adm/kernel
160 kern.crit @finlandia
161 kern.crit /dev/console
162 kern.info;kern.!err /var/adm/kernel-info
163
164 The first rule directs any message that has the kernel facility to the
165 file /var/adm/kernel. (But recall that only the kernel itself can log
166 to this facility.)
167
168 The second statement directs all kernel messages of the priority crit
169 and higher to the remote host finlandia. This is useful, because if
170 the host crashes and the disks get irreparable errors you might not be
171 able to read the stored messages. If they're on a remote host, too,
172 you still can try to find out the reason for the crash.
173
174 The third rule directs these messages to the actual console, so the
175 person who works on the machine will get them, too.
176
177 The fourth line tells the syslogd to save all kernel messages that come
178 with priorities from info up to warning in the file /var/adm/kernel-
179 info. Everything from err and higher is excluded.
180
181
182 # The tcp wrapper logs with mail.info, we display
183 # all the connections on tty12
184 #
185 mail.=info /dev/tty12
186
187 This directs all messages that uses mail.info (in source LOG_MAIL |
188 LOG_INFO) to /dev/tty12, the 12th console. For example the tcpwrapper
189 tcpd(8) uses this as its default.
190
191
192 # Store all mail concerning stuff in a file
193 #
194 mail.*;mail.!=info /var/adm/mail
195
196 This pattern matches all messages that come with the mail facility,
197 except for the info priority. These will be stored in the file
198 /var/adm/mail.
199
200
201 # Log all mail.info and news.info messages to info
202 #
203 mail,news.=info /var/adm/info
204
205 This will extract all messages that come either with mail.info or with
206 news.info and store them in the file /var/adm/info.
207
208
209 # Log info and notice messages to messages file
210 #
211 *.=info;*.=notice;\
212 mail.none /var/log/messages
213
214 This lets the syslogd log all messages that come with either the info
215 or the notice priority into the file /var/log/messages, except for all
216 messages that use the mail facility.
217
218
219 # Log info messages to messages file
220 #
221 *.=info;\
222 mail,news.none /var/log/messages
223
224 This statement causes the syslogd to log all messages that come with
225 the info priority to the file /var/log/messages. But any message com‐
226 ing either with the mail or the news facility will not be stored.
227
228
229 # Emergency messages will be displayed using wall
230 #
231 *.=emerg *
232
233 This rule tells the syslogd to write all emergency messages to all cur‐
234 rently logged in users. This is the wall action.
235
236
237 # Messages of the priority alert will be directed
238 # to the operator
239 #
240 *.alert root,joey
241
242 This rule directs all messages with a priority of alert or higher to
243 the terminals of the operator, i.e. of the users ``root'' and ``joey''
244 if they're logged in.
245
246
247 *.* @finlandia
248
249 This rule would redirect all messages to a remote host called finlan‐
250 dia. This is useful especially in a cluster of machines where all sys‐
251 log messages will be stored on only one machine.
252
254 Syslogd uses a slightly different syntax for its configuration file
255 than the original BSD sources. Originally all messages of a specific
256 priority and above were forwarded to the log file. The modifiers
257 ``='', ``!'' and ``-'' were added to make the syslogd more flexible
258 and to use it in a more intuitive manner.
259
260 The original BSD syslogd doesn't understand spaces as separators
261 between the selector and the action field.
262
264 /etc/syslog.conf
265 Configuration file for syslogd
267 The effects of multiple selectors are sometimes not intuitive. For
268 example ``mail.crit,*.err'' will select ``mail'' facility messages at
269 the level of ``err'' or higher, not at the level of ``crit'' or higher.
271 sysklogd(8), klogd(8), logger(1), syslog(2), syslog(3).
273 The syslogd is taken from BSD sources, Greg Wettstein <greg@wind.enjel‐
274 lic.com> performed the port to Linux, Martin Schulze <joey@info‐
275 drom.org> fixed some bugs, added several new features and took over
276 maintenance.
277
278
279
280Version 1.3 30 November 2006 SYSLOG.CONF(5)