]> git.saurik.com Git - apple/syslog.git/blob - syslogd.tproj/asl.conf.5
syslog-148.8.tar.gz
[apple/syslog.git] / syslogd.tproj / asl.conf.5
1 .\"Copyright (c) 2004-2011 Apple Inc. All rights reserved.
2 .\"
3 .\"@APPLE_LICENSE_HEADER_START@
4 .\"
5 .\"This file contains Original Code and/or Modifications of Original Code
6 .\"as defined in and that are subject to the Apple Public Source License
7 .\"Version 2.0 (the 'License'). You may not use this file except in
8 .\"compliance with the License. Please obtain a copy of the License at
9 .\"http://www.opensource.apple.com/apsl/ and read it before using this
10 .\"file.
11 .\"
12 .\"The Original Code and all software distributed under the License are
13 .\"distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 .\"EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 .\"INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 .\"FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
17 .\"Please see the License for the specific language governing rights and
18 .\"limitations under the License.
19 .\"
20 .\"@APPLE_LICENSE_HEADER_END@
21 .\"
22 .Dd Sept 19, 2008
23 .Dt asl.conf 5
24 .Os "Mac OS X"
25 .Sh NAME
26 .Nm asl.conf
27 .Nd configuration file for
28 .Xr syslogd 8
29 and
30 .Xr aslmanager 8
31 .Sh DESCRIPTION
32 The
33 .Xr syslogd 8
34 server reads the
35 .Nm
36 file at startup, and re-reads the file whenever it received a HUP signal.
37 The
38 .Xr aslmanager 8
39 daemon reads the file when it starts.
40 See the ASLMANAGER PARAMETER SETTINGS section below for details on those parameter settings.
41 .Pp
42 The file may contain parameter settings, used in place of (and which will override) command-line options,
43 and may contain query-action rules that trigger specific actions when
44 .Nm syslogd
45 receives messages that match the query pattern.
46 .Pp
47 Parameter setting lines in the configuration file begin with an equal sign
48 .Dq = ,
49 and are generally of the form:
50 .Pp
51 .Dl = parameter_name value ...
52 .Pp
53 Most parameter settings require a single value, although some may take several values.
54 See the PARAMETER SETTINGS section below for details.
55 .Pp
56 Query-action rules in the file begin with a question-mark ``?'' or a
57 .Dq Q ,
58 and generally have the form:
59 .Pp
60 .Dl ? query action ...
61 .Pp
62 Specific actions may be followed by optional arguments.
63 See the QUERY-ACTION RULES section below for details.
64 .Sh PARAMETER SETTINGS
65 The following parameter-settings are recognized by
66 .Nm syslogd .
67 .Pp
68 .Bl -tag -width "bsd_max_dup_time" -compact -offset indent
69 .It debug
70 Enables or disables internal debugging output.
71 This is probably of little interest to most users.
72 The debug parameter requires a value of
73 .Dq 1
74 to enable debug output, or a value of
75 .Dq 0
76 to disable it.
77 An option file name may follow the
78 .Dq 0
79 or
80 .Dq 1 .
81 If a file name is provided, debug messages are written to that file.
82 Otherwise, debug writes are treated as log messages.
83 .Pp
84 .It mark_time
85 Sets the time interval for the mark facility.
86 The default is 0 seconds, which indicates that mark messages are not generated.
87 .Pp
88 .It dup_delay
89 Sets the maximum time before writing a
90 .Dq "last message repeated <N> times"
91 message in a log file when duplicate messages have been detected.
92 The default is 30 seconds.
93 .Pp
94 .It utmp_ttl
95 Sets the time-to-live for messages used by the utmp, wtmp, and lastlog subsystems.
96 The default is 31622400 seconds (approximately 1 year).
97 .Pp
98 .It mps_limit
99 Sets the per-process message per second quota.
100 The default is value is 500.
101 A value of 0 disables the quota mechanism.
102 .Pp
103 .It max_file_size
104 Sets the maximum file size for individual files in the ASL data store.
105 The default is 25600000 bytes.
106 .El
107 .Pp
108 .Sh QUERY-ACTION RULES
109 Rules contain three components: a query; an action; and optionally, parameters specific to that action.
110 For example:
111 .Pp
112 .Dl ? [= Sender foobar] [<= Level error] notify com.apple.foobar
113 .Pp
114 .Ss Query Format
115 Queries comprise one or more message matching components, each of which has the form:
116 .Pp
117 .Dl [OP KEY VAL]
118 .Pp
119 OP is a comparison operator.
120 It can have the following values:
121 .Pp
122 .Bl -tag -width "<= " -compact -offset indent
123 .It T
124 true (always matches)
125 .It =
126 equal
127 .It !
128 not equal
129 .It >
130 greater than
131 .It >=
132 greater than or equal to
133 .It <
134 less than
135 .It <=
136 less than or equal to
137 .El
138 .Pp
139 It can also be preceded by one or more modifiers:
140 .Bl -tag -width "C " -compact -offset indent
141 .Pp
142 .It C
143 casefold
144 .It N
145 numeric comparison
146 .It S
147 substring
148 .It A
149 prefix
150 .It Z
151 suffix
152 .El
153 .Pp
154 KEY and VAL are message keys and values.
155 For example
156 .Pp
157 .Dl [= Sender foobar]
158 .Pp
159 matches any message with value
160 .Dq foobar
161 for the
162 .Dq Sender
163 key.
164 The query
165 .Pp
166 .Dl [CA= Color gr]
167 .Pp
168 matches any message with a value beginning with the letters GR, Gr, gr, or gR
169 (C meaning casefold, A meaning prefix) for the
170 .Dq Color
171 key.
172 The example query above,
173 .Pp
174 .Dl [= Sender foobar] [N< Level 3]
175 .Pp
176 matches any message from
177 .Dq foobar
178 with a level numerically less than 3
179 (string values are converted to integers, and the comparison is done on the integer values).
180 Note that the string values may be used equivalently for the Level key,
181 so the example above may also be written as:
182 .Pp
183 .Dl [= Sender foobar] [< Level Error]
184 .Pp
185 String values for levels may be any of the set
186 .Dq emergency ,
187 .Dq alert ,
188 .Dq critical ,
189 .Dq error ,
190 .Dq warning ,
191 .Dq notice ,
192 .Dq info , or
193 .Dq debug .
194 These strings may be upper, lower, or mixed case.
195 .Pp
196 The
197 .Dq T
198 operator is useful to test for the presence of a particular key.
199 .Pp
200 .Dl [T Flavor]
201 .Pp
202 Will match any message that has a
203 .Dq Flavor
204 key, regardless of its value.
205 .Pp
206 .Ss Actions
207 The following actions are available.
208 .Pp
209 .Bl -tag -width "store_directory" -compact -offset indent
210 .It notify
211 Causes
212 .Nm syslogd
213 to post a notification with
214 .Fn notify_post .
215 The notification key must appear as a single parameter following the
216 .Dq notify
217 action.
218 .Pp
219 .It access
220 Sets read access controls for messages that match the associated query pattern.
221 .Nm syslogd
222 will restrict read access to matching messages to a specific user and group.
223 The user ID number and group ID number must follow the
224 .Dq access
225 keyword as parameters.
226 .Pp
227 .It store
228 Causes
229 .Nm syslogd
230 to save matching messages, either in the main ASL data store,
231 or in a separate log message data store file is a file name is given as a parameter.
232 A separate data store file may be accessed using the
233 .Nm syslog
234 command line utility.
235 A new file will be created if one does not exist.
236 If a new file is being created, the UID, GID, and mode of the file may be specified using the options
237 .Dq uid=UUU ,
238 .Dq gid=GGG ,
239 and
240 .Dq mode=MMMM ,
241 where UUU and GGG are a user ID and group ID, and MMMM is a
242 mode specification of the form
243 .Dq 0644
244 with a leading zero for an octal number or DDD for a decimal number.
245 .Pp
246 Two other optional parameters may also follow the pathname.
247 .Pp
248 If a separate log message data store file is specified as a parameter, then
249 .Nm syslogd
250 will open the database, save a matching message, and then close the database.
251 If a high volume of messages is expected, specifying the
252 .Dq stayopen
253 option will improve performance.
254 .Pp
255 Also, if a separate log message data store file is specified as a parameter,
256 matching messages will be excluded from all further processing.
257 Adding the
258 .Dq continue
259 option will cause syslogd to save matching messages in the specified store file
260 and then continue processing matching messages in accordance with the actions
261 specified in /etc/asl.conf and /etc/syslog.conf.
262 .Pp
263 Note that if the
264 .Nm asl.conf
265 configuration file contains no matching rules for the main ASL data store, then
266 .Nm syslogd
267 will save all messages.
268 .Pp
269 .It store_directory
270 Causes matching messages to be stored in a log message data store file in a separate directory.
271 The directory path name must follow as the first parameter.
272 The named directory must exist.
273 .Nm syslogd
274 will not create the directory path.
275 .Pp
276 Messages saved to a store directory are saved in files that are named
277 .Dq yyyy.mm.dd.asl ,
278 where
279 .Dq yyyy ,
280 .Dq mm ,
281 and
282 .Dq dd
283 are the year, month (01 to 12) and day of the month (01 to 31) associated with
284 matching messages.
285 This has the effect of saving messages in a separate file for each day.
286 .Pp
287 The
288 .Dq uid=UUU ,
289 .Dq gid=GGG ,
290 .Dq mode=MMMM ,
291 and
292 .Dq continue
293 options available for the
294 .Dq store
295 action
296 may also be specified for a store directory.
297 The uid, gid, and mode specification will be used when the individual daily store files are created.
298 .Pp
299 .It file
300 Causes matching messages to be stored in a log file.
301 The file's path name must follow as the first parameter.
302 The file's directory must exist.
303 If the path already exists, it must be a plain file.
304 Otherwise
305 .Nm syslogd
306 will create the file.
307 The file's owner will be root, and the file's group will be admin.
308 A file mode may be specified as an option of the form
309 .Dq mode=MMMM
310 as described above.
311 One or more UIDs may be given as the values of options of the form
312 .Dq uid=UUU .
313 One or more GIDs may be given as the values of options of the form
314 .Dq gid=GGG .
315 If any UIDs or GIDs are provided, the specified users and groups will be given read access to the file.
316 Note that UIDs and GIDs should be defined in the local Open Directory database, since
317 .Nm syslogd
318 starts and may create the log file before network directory services are available.
319 Unknown UIDs and GIDs will be ignored when setting access controls.
320 .Pp
321 By default, log files will be written using the same format used for printing by
322 .Nm syslog
323 when the
324 .Fl F Ar std
325 flag is supplied.
326 A print format may be specified as the value of the
327 .Dq format=FMT
328 option.
329 The default is
330 .Dq format=std .
331 Alternate file formats, including
332 .Dq bsd
333 and
334 .Dq raw
335 are supported.
336 Custom formats may be specified as well, using the syntax supported by
337 .Nm syslog Fl F .
338 Space and tab character in a custom format string must be escaped with a leading backslash character.
339 Custom format strings may include variables of the form
340 .Dq $Name
341 .Dq $(Name)
342 or
343 .Dq $((Name)(fmt)) .
344 which will be expanded to the associated with the named key.
345 The first form may be used in most cases.
346 The second form may be used if the variable is not delimited by whitespace.
347 The third form permits the selection of alternate output formats for certain keys,
348 such as Time and Level.
349 See
350 .Xr syslog 1
351 for details.
352 .Pp
353 For example, the option:
354 .Pp
355 .Dl format=$((Time)(Z))\ $Host\ $(Sender)[$(PID)]\ <$((Level)(str))>:\ $Message
356 .Pp
357 produces output similar to the
358 .Dq std
359 format, but using the UTC (Zulu) timezone.
360 .Pp
361 By default, files printed using the
362 .Dq bsd
363 and
364 .Dq std
365 formats will suppress printing duplicates.
366 If two or more messages are logged within 30 seconds, and which differ only in time,
367 then the second and subsequent messages will not be printed.
368 When a different message is logged, or 30 seconds have elapsed since the initial
369 message was logged, a line with the text
370 .Dl --- last message repeated N times ---
371 will be added to the file.
372 The default may be disabled using the
373 .Dq no_dup_supress
374 option.
375 .Pp
376 .It broadcast
377 Causes syslogd to write the text of matching messages to all terminal windows.
378 If optional text follows the
379 .Dq broadcast
380 keyword, then that text is written rather that the matching message text.
381 .Pp
382 .It ignore
383 Causes a matching message to be ignored in all subsequent matching rules.
384 .El
385 .Sh ASLMANAGER PARAMETER SETTINGS
386 The following parameter-settings are recognized by
387 .Nm aslmanager .
388 .Pp
389 .Bl -tag -width "aslmanager_debug" -compact -offset indent
390 .It aslmanager_debug
391 Enables or disables internal debugging output.
392 This is probably of little interest to most users.
393 The debug parameter requires a value of
394 .Dq 1
395 to enable debug output, or a value of
396 .Dq 0
397 to disable it.
398 Debug messages are sent to
399 .Nm syslogd .
400 .Pp
401 .It store_ttl
402 Sets the time-to-live in days for messages in the syslog data store.
403 The default is 7 days.
404 .Pp
405 .It max_store_size
406 Sets the maximum size for for the ASL data store.
407 The default is 150000000 bytes.
408 .Pp
409 .It archive
410 Enables or disables archiving.
411 The archive parameter requires a value of
412 .Dq 1
413 to enable archiving, or a value of
414 .Dq 0
415 to disable it.
416 An option archive directory path may follow the
417 .Dq 0
418 or
419 .Dq 1 .
420 If enabled, files removed from the ASL data store are moved to the archive directory.
421 The default archive directory path is /var/log/asl.archive.
422 .Pp
423 .It store_path
424 The data store path used by
425 .Nm aslmanager .
426 The default is /var/log/asl.
427 Note that this parameter is ignored by
428 .Nm syslogd .
429 .It archive_mode
430 Files copied to the archive will be given the specified access mode.
431 The default is 0400, so archive files will only be readable by root.
432 .El
433 .Pp
434 .Sh SEE ALSO
435 .Xr asl 3 ,
436 .Xr notify 3 ,
437 .Xr syslog 1 ,
438 .Xr aslmanager 8 ,
439 .Xr syslogd 8 .