]> git.saurik.com Git - apple/syslog.git/blob - syslogd.tproj/asl.conf.5
85617b92fa143fa251859d2d03586dd440c12f0e
[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 /etc/asl.conf file at startup, and re-reads the file when it receives a HUP signal.
35 The
36 .Xr aslmanager 8
37 daemon reads the file when it starts.
38 See the ASLMANAGER PARAMETER SETTINGS section for details on aslmanager-specific parameters.
39 .Pp
40 If the /etc/asl directory exists, then
41 .Nm syslogd
42 and
43 .Nm aslmanager
44 will read each file it contains.
45 These files must have the same format as
46 .Nm asl.conf .
47 Each file configures an independent module, identified by the file name.
48 Modules may be enabled or disabled independently.
49 Each module may specify its own set of rules for acting on received messages.
50 See the ASL MODULES section for details.
51 .Pp
52 The files contains four types of lines.
53 Each type is identified by the first non-whitespace character.
54 .Pp
55 .Bl -tag -width "=" -compact
56 .It =
57 Parameter settings
58 .It ?
59 Query-action rules
60 .It >
61 Output file or directory configuration options
62 .It #
63 Comments
64 .El
65 .Pp
66 Parameter setting lines in the configuration file are generally of the form:
67 .Pp
68 .Dl = parameter_name value ...
69 .Pp
70 Most parameter settings require a single value, although some may take several values.
71 See the PARAMETER SETTINGS section for details.
72 .Pp
73 Query-action rules in the file generally have the form:
74 .Pp
75 .Dl ? query action ...
76 .Pp
77 This directs
78 .Nm syslogd
79 to perform the specified action when a received message matches the given query.
80 Actions may be followed by optional arguments.
81 See the QUERY-ACTION RULES section for details.
82 .Pp
83 Most query-action rules specify output files or ASL-format data stores where matching messages should be saved.
84 The optional parameters for those rules can specify a number of options for these outputs.
85 As a convenience, these configuration options may be specified on a separate line.
86 Output configuration settings in the file begin with a greater-than sign
87 .Dq >
88 followed by a file or ASL directory name and the configuration options for that file or directory.
89 These lines generally have the form:
90 .Pp
91 .Dl > filename option ...
92 .Pp
93 See the OUTPUT CONFIGURATION SETTINGS section for details.
94 .Pp
95 Comments lines are ignored.
96 .Ss PARAMETER SETTINGS
97 The following parameter-settings are recognized by
98 .Nm syslogd .
99 .Pp
100 .Bl -tag -width "bsd_max_dup_time" -compact -offset indent
101 .It debug
102 Enables or disables internal debugging output.
103 This is probably of little interest to most users.
104 The debug parameter requires a value of
105 .Dq 1
106 to enable debug output, or a value of
107 .Dq 0
108 to disable it.
109 Debugging messages are written to /var/log/syslogd.log.
110 .Pp
111 .It mark_time
112 Sets the time interval for the mark facility.
113 The default is 0 seconds, which indicates that mark messages are not generated.
114 .Pp
115 .It dup_delay
116 Sets the maximum time before writing a
117 .Dq "last message repeated <N> times"
118 message in a log file when duplicate messages have been detected.
119 The default is 30 seconds.
120 .Pp
121 .It utmp_ttl
122 Sets the time-to-live for messages used by the utmp, wtmp, and lastlog subsystems.
123 The default is 31622400 seconds (approximately 1 year).
124 .Pp
125 .It mps_limit
126 Sets the kernel message per second quota.
127 The default is value is 500.
128 A value of 0 disables the quota mechanism.
129 Note that this setting only limits the number of kernel messages that will be saved by
130 .Nm syslogd .
131 User processes are limited to 36000 messages per hour.
132 The limit for a user process is not enforced if a remote-control ASL filter is in
133 place for the process.
134 See the
135 .Xr syslog 1
136 manual for enabling a remote-control filter using the
137 .Fl c
138 option with the
139 .Nm syslog
140 command.
141 .Pp
142 .It max_file_size
143 Sets the maximum file size for individual files in the ASL database.
144 The default is 25600000 bytes.
145 .El
146 .Ss QUERY-ACTION RULES
147 Query-action rules are used to cause
148 .Nm syslogd
149 to perform specific actions when received messages match a specified query pattern.
150 For example, to save certain messages in a file.
151 The rules are processed in the order in which they appear in the file.
152 This matters because some actions can affect further processing.
153 For example, an
154 .Dq ignore
155 action causes
156 .Nm syslogd
157 to stop processing the rules in a file for messages that match a given query pattern.
158 .Pp
159 Query-action rules contain three components: a query, an action, and optional parameters specific to that action.
160 For example, the following rule matches log messages sent by the
161 .Dq example
162 process which have log priority levels in the range emergency to error.
163 If a received message matches,
164 .Nm syslogd
165 posts a BSD notification for the key
166 .Dq com.example.log_message .
167 .Pp
168 .Dl ? [= Sender example] [<= Level error] notify com.example.log_message
169 .Ss Query Format
170 Queries comprise one or more message matching components, each of which has the form:
171 .Pp
172 .Dl [OP KEY VAL]
173 .Pp
174 OP is a comparison operator.
175 It can have the following values:
176 .Pp
177 .Bl -tag -width "<= " -compact -offset indent
178 .It T
179 true (always matches)
180 .It =
181 equal
182 .It !
183 not equal
184 .It >
185 greater than
186 .It >=
187 greater than or equal to
188 .It <
189 less than
190 .It <=
191 less than or equal to
192 .El
193 .Pp
194 It can also be preceded by one or more modifiers:
195 .Bl -tag -width "C " -compact -offset indent
196 .Pp
197 .It C
198 casefold
199 .It N
200 numeric comparison
201 .It S
202 substring
203 .It A
204 prefix
205 .It Z
206 suffix
207 .El
208 .Pp
209 KEY and VAL are message keys and values.
210 For example
211 .Pp
212 .Dl [= Sender example]
213 .Pp
214 matches any message with value
215 .Dq example
216 for the
217 .Dq Sender
218 key.
219 The query
220 .Pp
221 .Dl [CA= Color gr]
222 .Pp
223 matches any message with a value beginning with the letters GR, Gr, gr, or gR
224 (
225 .Dq C
226 meaning casefold,
227 .Dq A
228 meaning prefix) for the
229 .Dq Color
230 key.
231 The example query above,
232 .Pp
233 .Dl [= Sender example] [N< Level 3]
234 .Pp
235 matches any message from
236 .Dq example
237 with a level numerically less than 3
238 (string values are converted to integers, and the comparison is done on the integer values).
239 Note that the string values may be used equivalently for the Level key,
240 so the example above may also be written as:
241 .Pp
242 .Dl [= Sender example] [< Level Error]
243 .Pp
244 String values for levels may be any of the set
245 .Dq emergency ,
246 .Dq alert ,
247 .Dq critical ,
248 .Dq error ,
249 .Dq warning ,
250 .Dq notice ,
251 .Dq info ,
252 or
253 .Dq debug .
254 These strings may be upper, lower, or mixed case.
255 .Pp
256 The
257 .Dq T
258 operator is useful to test for the presence of a particular key.
259 .Pp
260 .Dl [T Flavor]
261 .Pp
262 Will match any message that has a
263 .Dq Flavor
264 key, regardless of its value.
265 .Pp
266 As a special case, the query
267 .Pp
268 .Dl *
269 .Pp
270 matches all messages.
271 .Ss Actions
272 The following actions are available.
273 .Pp
274 .Bl -tag -width "directory" -compact -offset indent
275 .It store
276 Causes
277 .Nm syslogd
278 to save matching messages in the ASL database.
279 Note that if /etc/asl.conf contains no
280 .Dq store
281 action rules, then
282 .Nm syslogd
283 will save all messages it receives in the ASL database.
284 .Pp
285 .It file
286 Causes matching messages to be stored in a log file.
287 The file's path name must follow as the first parameter.
288 If the path already exists, it must be a plain file.
289 If the file does not exist, it will be created when the first message is written.
290 If the pathname specified is not an absolute path,
291 .Nm syslogd
292 will treat the given path as relative to /var/log (for /etc/asl.conf),
293 or for other output modules relative to /var/log/module/NAME where NAME is the module name.
294 .Pp
295 By default, the file's owner will be root, and the file will be readable by the admin group.
296 Various options may follow the file name to specify ownership and access controls,
297 printed log message format, and controls for file rotation, compression, time-to-live,
298 and other aspects of output file life-cycle management.
299 See the OUTPUT CONFIGURATION SETTINGS section for more details.
300 .Pp
301 .It directory
302 Causes matching messages to be stored in an ASL-format log message data store.
303 A directory path name must follow as the first parameter.
304 If the path exists, it must be a directory.
305 .Pp
306 Messages saved to an ASL directory are saved in files that are named
307 .Dq yyyy.mm.dd.asl ,
308 where
309 .Dq yyyy ,
310 .Dq mm ,
311 and
312 .Dq dd
313 are the year, month (01 to 12) and day of the month (01 to 31) associated with
314 matching messages.
315 This has the effect of saving messages in a separate file for each day.
316 .Pp
317 By default, files in the directory will be owned by root, and readable by the admin group.
318 Various options may follow the directory name to control ownership, access controls,
319 and the management of the store and its contents.
320 See the OUTPUT CONFIGURATION SETTINGS section for a list of options that may be set for store directories.
321 .Pp
322 .It notify
323 Causes
324 .Nm syslogd
325 to post a notification with
326 .Fn notify_post .
327 The notification key must appear as a single parameter following the
328 .Dq notify
329 action.
330 .Pp
331 .It skip
332 Causes a matching message to be ignored in all subsequent matching rules in the file.
333 Its scope is local to a single module configuration file.
334 .Pp
335 .It claim
336 Messages that match the query associated with a
337 .Dq claim
338 action are not processed by the main ASL configuration file /etc/asl.conf.
339 While claimed messages are not processed by /etc/asl.conf,
340 they are not completely private.
341 Other modules may also claim messages,
342 and in some cases two or more modules may have claim actions
343 that match the same messages.
344 This action only blocks processing by /etc/asl.conf.
345 .Pp
346 The
347 .Dq claim
348 action may be followed by the keyword
349 .Dq only .
350 In this case, only those messages that match the
351 .Dq claim only
352 query will be processed by subsequent rules in the module.
353 .Pp
354 .It access
355 Sets read access controls for messages that match the associated query pattern.
356 .Nm syslogd
357 will restrict read access to matching messages to a specific user and group.
358 The user ID number and group ID number must follow the
359 .Dq access
360 keyword as parameters.
361 .Pp
362 .It broadcast
363 Causes syslogd to write the text of matching messages to all terminal windows.
364 If optional text follows the
365 .Dq broadcast
366 keyword, then that text is written rather that the matching message text.
367 Note that this action is restricted to the main ASL configuration file /etc/asl.conf.
368 .Pp
369 .It ignore
370 Causes a matching message to be ignored in all subsequent matching rules in the file.
371 This action is equivalent to the
372 .Dq skip
373 action in all module configuration files except the main ASL configuration file /etc/asl.conf.
374 When used in the main configuration file, the scope of the action is global,
375 and matching messages will be ignored by all ASL modules.
376 .El
377 .Ss OUTPUT CONFIGURATION SETTINGS
378 Various options may follow the path name in a
379 .Dq file
380 or
381 .Dq directory
382 query-action rule.
383 For example, the following rule specifies that all messages from the
384 .Dq example
385 facility will be saved in the file
386 .Dq example.log ,
387 and that messages are printed in a
388 .Dq raw
389 format that shows all the keys and values in the message:
390 .Pp
391 .Dl ? [= Facility example] file example.log format=raw
392 .Pp
393 Multiple options may be specified separated by whitespace characters.
394 For example:
395 .Pp
396 .Dl ? [= Facility example] file example.log format=raw rotate=local compress ttl=3 mode=0640 uid=0 gid=5 gid=20
397 .Pp
398 As a convenience, a file or directory name and any associated options can be specified on a separate
399 output configuration line following a
400 .Dq >
401 character:
402 .Pp
403 .Dl > example.log format=raw rotate=local compress ttl=3 mode=0640 uid=0 gid=5 gid=20
404 .Pp
405 Options for a file or directory are taken from the first query-action rule
406 or output configuration line for the given path.
407 A good usage pattern for multiple rules that specify the same output file or directory is:
408 .Pp
409 .Dl > example.log options ...
410 .Dl ? query1 file example.log
411 .Dl ? query2 file example.log
412 .Dl ? query3 file example.log
413 .Pp
414 Most of the options listed below may be used with either file or directory outputs.
415 Exceptions are noted.
416 .Pp
417 .Bl -tag -width "coalesce=VAL" -compact -offset indent
418 .It format=FMT
419 Controls the format of log messages saved in a file.
420 Note that this option is specific to file outputs.
421 It is ignored for ASL directories.
422 .Pp
423 The format is specified by the value given for FMT.
424 Several pre-defined formats are available:
425 .Bl -tag -width "abcd"
426 .It bsd
427 Format used by the
428 .Nm syslogd
429 daemon for system log files, e.g. /var/log/system.log.
430 .It std
431 Standard (default) format.
432 Similar to
433 .Dq bsd ,
434 but includes the message priority level.
435 .It raw
436 Prints the complete message structure.
437 Each key/value pair is enclosed in square brackets.
438 Embedded closing brackets and white space are escaped.
439 Time stamps are printed as seconds since the epoch.
440 .It xml
441 The list of messages is printed as an XML property list.
442 Each message is represented as a dictionary in a array.
443 Dictionary keys represent message keys.
444 Dictionary values are strings.
445 .It asl
446 The output file is written as an ASL-format data store file.
447 Files in this format may be read and searched using the
448 .Nm syslog
449 command line utility with the use of the
450 .Fl f Ar path
451 option.
452 .El
453 .Pp
454 Custom format strings may also be specified.
455 Since custom formats often contain white-space characters,
456 the entire string may be enclosed in single or double quote characters,
457 or each white-space character may be preceded by a backslash escape character.
458 Escaped characters are not interpreted.
459 Custom format strings are described in detail in the READING MESSAGES section of the
460 .Xr syslog 1
461 manual.
462 .Pp
463 .It mode=MMM
464 Sets the mode of the file or files within an ASL directory.
465 The value MMM may be specified as a decimal value,
466 a hexadecimal value (if preceded by ``0x''),
467 or octal value (if preceded by ``0'').
468 .Pp
469 .It uid=UUU
470 Specifies the file's owner.
471 If more than one
472 .Dq uid=UUU
473 option is given, the first will be used to set ownership,
474 and subsequent user IDs will be given read access to in the files POSIX.1e ACLs.
475 Note that UIDs should be defined in the local Open Directory database, since
476 .Nm syslogd
477 starts and may create the log file before network directory services are available.
478 Unknown UIDs and GIDs will be ignored when setting access controls.
479 .Pp
480 .It gid=GGG
481 Specifies the file's group.
482 If more than one
483 .Dq gid=GGG
484 option is given, the first will be used to set the file's group,
485 and subsequent group IDs will be given read access to in the files POSIX.1e ACLs.
486 As with UID=UUU options, groups should be defined in the local Open Directory database.
487 .Pp
488 .It coalesce=VAL
489 By default, files printed using the
490 .Dq bsd
491 and
492 .Dq std
493 formats will coalesce duplicates.
494 If two or more messages are logged within 30 seconds, and which differ only in time,
495 then the second and subsequent messages will not be printed.
496 When a different message is logged, or 30 seconds have elapsed since the initial
497 message was logged, a line with the text
498 .Dl --- last message repeated N times ---
499 will be added to the file.
500 The default is
501 .Dq coalesce=1 .
502 The default may be overridden by specifying
503 .Dq coalesce=0 .
504 The values
505 .Dq off
506 and
507 .Dq false
508 may be used in place of
509 .Dq 0 .
510 .El
511 .Pp
512 The following options all deal with file rotation and life-cycle management.
513 The FILE ROTATION section describes this in detail.
514 .Pp
515 .Bl -tag -width "rotate=NAME_STYLE" -compact -offset indent
516 .Pp
517 .It rotate=NAME_STYLE
518 Enables log file rotation and specifies the file naming scheme for rotated files.
519 This option does not apply to ASL directories.
520 Four styles are supported:
521 .Pp
522 .Bl -tag -width "local-basic" -compact -indent
523 .It sec
524 Rotated file names are of the form
525 .Dq example.log.T1340607600 .
526 The file names include the creation time of the file in seconds since the epoch.
527 .Pp
528 .It utc
529 Rotated file names are in ISO 8601 extended format, for example
530 .Dq example.log.2012-06-24T07:00:00Z .
531 The file names includes its creation time as a UTC date and time.
532 .Pp
533 .It utc-basic
534 Rotated file names are in ISO 8601 basic format, for example
535 .Dq example.log.20120624T070000Z .
536 The file names includes its creation time as a UTC date and time.
537 .Pp
538 .It local
539 Rotated file names are in ISO 8601 extended format, for example
540 .Dq example.log.2012-06-24T07:00:00-7 .
541 The file names includes its creation time as date and time in the local time zone.
542 The local timezone offset is included as a trailing part of the name.
543 .Pp
544 .It local-basic
545 Rotated file names are in ISO 8601 basic format, for example
546 .Dq example.log.20120624T070000-07 .
547 The file names includes its creation time as date and time in the local time zone.
548 The local timezone offset is included as a trailing part of the name.
549 .Pp
550 .It seq
551 Rotated file names are of the form
552 .Dq example.log.N
553 where N is an integer sequence number.
554 Files are re-numbered on each rotation so that the
555 .Dq 0
556 file is the most recent.
557 .El
558 .Pp
559 If the option
560 .Dq rotate
561 appears without a value, the naming style defaults to
562 .Dq "sec" .
563 .Pp
564 Note that using the local timezone for timestamped files may cause odd behavior on highly-mobile systems.
565 .Nm aslmanager
566 will delete files after a specified time-to-live (see below).
567 The age of the file is determined by the file name.
568 If files are created in different timezones but saved with a non-absolute timestamp,
569 the age calculation may result in some files being considered older or newer than they are in reality.
570 .Pp
571 Also note that sequenced files (using the
572 .Dq sec
573 style) will initially be checkpointed using a file name containing a timestamp in seconds.
574 .Nm aslmanager
575 will re-sequence the files when it scans for checkpoint files.
576 .Pp
577 .It ttl=DAYS
578 Specifies the number of days that older versions of rotated files should be allowed to remain in the filesystem.
579 Rotated files older than this limit are deleted.
580 .Pp
581 .It dest=PATH
582 By default, rotated files are left in the same directory as the original file.
583 However, in some cases it may be useful to move the rotated versions to a different
584 directory for archival or other reasons.
585 If this option is specified,
586 .Nm aslmanager
587 will move files to the directory given by PATH.
588 .Pp
589 .It soft
590 Makes
591 .Nm syslogd
592 ignore write errors when saving messages.
593 Normally,
594 .Nm syslogd
595 will stop saving to a file or ASL directory after 5 consecutive write errors.
596 .Pp
597 .It compress
598 Enables gzip file compression for rotated log files.
599 When compressed, the extension
600 .Dq .gz
601 is appended to the file name.
602 .Pp
603 .It file_max=SIZE
604 Limits the size of an active log file.
605 SIZE may be an integer number of bytes, or the value may be followed by a single character
606 .Dq k ,
607 .Dq m ,
608 or
609 .Dq g
610 (upper or lower case),
611 to indicate a size limit in multiples of 1024 (kibibyte), 1048576 (mebibyte), or 1073741824 (gibibyte).
612 If a file exceeds this limit, it is immediately checkpointed by
613 .Nm syslogd
614 and a new file is opened.
615 Note that
616 .Dq file_max
617 specifies a size limit before file compression is performed if the
618 .Dq compress
619 option is also present.
620 .Pp
621 .It all_max=SIZE
622 Specifies a size limit for the total of all rotated versions of a file.
623 .Nm aslmanager
624 will delete rotated files, oldest first, to reduce the total below the limit.
625 SIZE may be specified in the same format as the file_max option.
626 .El
627 .Ss FILE ROTATION
628 .Nm syslogd
629 and
630 .Nm aslmanager
631 work together to automatically provide all the features of file rotation.
632 However, it is useful to understand how the process works.
633 This section describes the file rotation options that may be used in /etc/asl.conf
634 or an ASL Output Module configuration file,
635 together with a description of how the system works to support those features.
636 .Pp
637 If a file is marked for rotation,
638 .Nm syslogd
639 will close the file at the start of a new day or when the file exceeds its
640 .Dq file_max
641 size limit.
642 At that point,
643 .Nm syslogd
644 renames the file and starts a new file to continue logging.
645 The old file is renamed with the file's creation time included in its name.
646 This operation is called checkpointing the file.
647 .Pp
648 For example,
649 .Nm syslogd
650 might close
651 .Dq example.log
652 and rename it
653 .Dq example.log.T1340521200 ,
654 1340521200 being the time that the file was created.
655 It would then start a new
656 .Dq example.log
657 file and use it until midnight, when the cycle would be repeated.
658 .Pp
659 Files are normally checkpointed at midnight.
660 If the system is sleeping or powered off, then files are checkpointed when
661 the the first message of a new day (local time) is received.
662 Files are also checkpointed if they exceed a size limit specified by a file_max option,
663 and they may be checkpointed manually through options provided by the
664 .Xr syslog 1
665 and
666 .Xr aslmanager 8
667 utilities.
668 The checkpointed file name always contains the file's creation time.
669 If the options for the file include
670 .Dq rotate=utc
671 then the timestamp will be a UTC date and time string.
672 .Dq rotate=local
673 causes the timestamp to be the date and time in the current local timezone.
674 Otherwise, the timestamp will be in seconds since the epoch.
675 .Pp
676 .Nm syslogd
677 only performs the checkpointing operation.
678 It closes old files, moves them out of the way, and starts writing new files.
679 Most of the work of file rotation is done by the
680 .Xr aslmanager 8
681 utility.
682 That includes moving files to a destination directory, compressing files,
683 re-naming files according to one of the naming style options,
684 deleting old files after they exceed their time-to-live,
685 and checking file space usage.
686 .Pp
687 .Nm aslmanager
688 normally runs once during system start-up, and once a day just after midnight.
689 It may also be triggered occasionally by
690 .Nm syslogd ,
691 and it may be run manually.
692 .Pp
693 .Nm aslmanager
694 scans for any checkpointed files created by
695 .Nm syslogd
696 and will rename the files (if required) to match the naming style specified by the
697 .Dq rotate=NAME_STYLE
698 option.
699 If
700 .Dq rotate=seq
701 is specified for a file, checkpointed files created by
702 .Nm syslogd
703 contain a timestamp in seconds.
704 These files are renamed so that the file names
705 contain a sequence number.
706 The most recent version has the number
707 .Dq 0 ,
708 and older versions have higher numbers.
709 For example:
710 .Pp
711 .Dl example.log.0
712 .Dl example.log.1
713 .Dl example.log.2
714 .Dl ...
715 .Pp
716 As well as renaming files,
717 .Nm aslmanager
718 may perform other actions.
719 If the file has been given a
720 .Dq dest=PATH
721 option,
722 the rotated versions of the file will be moved to the specified directory.
723 Files will be gzip compressed using the
724 .Xr zlib 3
725 library if the
726 .Dq compress
727 option has been given.
728 If the total size of all the rotated versions of the file exceeds a value given in an
729 .Dq all_max
730 option, older version of the rotated file will be deleted to keep the total below the specified limit.
731 .Pp
732 Although checkpoint and file rotation operations are normally done automatically,
733 .Nm aslmanager
734 supports an option that will trigger
735 .Nm syslogd
736 to checkpoint files before
737 .Nm aslmanager
738 starts its scan.
739 .Nm syslog
740 also supports an option to force files to be checkpointed without running
741 .Nm aslmanager .
742 See the
743 .Xr aslmanager 8
744 and
745 .Xr syslog 1
746 manuals for details.
747 .Ss ASL OUTPUT MODULES
748 .Pp
749 An ASL output module is created by a configuration file in the directory /etc/asl.
750 The file name is used as the module's name.
751 The format of the file is generally the same as
752 .Nm asl.conf
753 with a few exceptions.
754 Mdules may not have parameter setting lines for the system parameters listed in the
755 PARAMETER SETTINGS or ASLMANAGER PARAMETER SETTINGS sections,
756 nor may they include
757 .Dq broadcast
758 query-action rules.
759 .Pp
760 Module configuration files are read by
761 .Nm syslogd
762 when it starts, and whenever it gets a HUP signal.
763 Messages received by
764 .Nm syslogd
765 are first processed according the the rules found in /etc/asl.conf
766 (also known as the
767 .Dq com.apple.asl
768 module), then the message is processed by the
769 rules from each module found in /etc/asl.
770 .Pp
771 An exception to this is that messages that match the query in a
772 .Dq claim
773 action rule in any module are not processed by the rules in /etc/asl.conf.
774 .Pp
775 ASL output modules are enabled by default, but a module may include a parameter setting:
776 .Pp
777 .Dl = enable 0
778 .Pp
779 The module is still loaded by
780 .Nm syslogd ,
781 but the module will not save messages to files or directories, and will not post BSD notifications.
782 .Pp
783 Several mechanisms allow modules to be enabled or disabled dynamically.
784 One mechanism allows the setting of the
785 .Dq enable
786 parameter to be based on the existence of a path in the filesystem,
787 or on the value associated with a dictionary key in a property list file.
788 On iOS only, the value of a key in an installed configuration profile may be tested.
789 .Pp
790 To enable a module based on the existence of a file, the module may use:
791 .Pp
792 .Dl = enable [File /a/b/c]
793 .Pp
794 where
795 .Dq /a/b/c
796 may be any filesystem path.
797 .Pp
798 To enable a module based on the value of a dictionary key in a property list file,
799 .Pp
800 .Dl = enable [Plist /path/config.plist] [= SomeKey SomeValue]
801 .Pp
802 Any of the test operations described above in the QUERY-ACTION RULES section
803 may also be used in testing key / value pairs.
804 Multiple operations are also allowed, for example:
805 .Pp
806 .Dl = enable [Plist /path/config.plist] [N>= DebugLevel 7] [S= Othervalue xyz]
807 .Pp
808 If the property list file does not exist, the test will evaluate to zero.
809 The file may be in binary or xml format.
810 It may only contain a single dictionary object at its top level.
811 Only keys and values at the top level of the dictionary may be tested.
812 Values must be strings, integer values, doubles, UUIDs, dates, or booleans.
813 Boolean <true/> and <false/> values are converted to 1 and 0 respectively.
814 Values are converted into strings,
815 and string comparisons are used unless unless an
816 .Dq N
817 modifier is specified with the test operator.
818 .Pp
819 On iOS, a module may test key / value pairs in a configuration profile using the
820 same key / value tests that may be used for property list files.
821 .Pp
822 .Dl = enable [Profile name] [= Verbose 1]
823 .Pp
824 The profile name is the value of its DefaultsDomainName key.
825 The test will evaluate to zero if the profile is not installed.
826 .Pp
827 A module may be also enabled or disabled using
828 .Nm syslog
829 or by sending
830 .Nm syslogd
831 a special
832 .Xr asl 3
833 control message.
834 Only the user
835 .Dq root
836 may enable or disable modules.
837 .Pp
838 A module may be enabled or disabled by sending an
839 .Xr asl 3
840 message as shown in this example, which enables a module named
841 .Dq com.apple.example :
842 .Pp
843 #include <asl.h>
844 aslmsg ctl = asl_new(ASL_TYPE_MSG);
845 asl_set(ctl, ASL_KEY_OPTION, "control");
846 asl_set(ctl, ASL_KEY_MSG, "@ com.apple.example enable 1");
847 asl_send(NULL, ctl);
848 asl_free(ctl);
849 .Pp
850 A control message may also be sent using
851 .Nm syslog
852 as the following example shows to disable a module named
853 .Dq com.apple.example :
854 .Pp
855 .Dl sudo syslog -module com.apple.example enable 0
856 .Pp
857 A module may also enable or disable itself.
858 Although a module that is not enabled will not write or post notifications,
859 it still will scan messages.
860 The module may contain conditional parameter-setting rules like:
861 .Pp
862 .Dl = [= Color Green] enable 1
863 .Dl = [= Color Red] enable 0
864 .Pp
865 This is similar to a query-action rule.
866 If a message received by syslogd matches the specified query,
867 in this case having a Color key with the value Green or Red,
868 then the enable parameter is set as specified.
869 So in this example, the module would be enabled and disabled
870 whenever syslogd received a message containing the appropriate value for the
871 .Dq Color
872 key.
873 .Ss ASLMANAGER PARAMETER SETTINGS
874 The following parameter-settings are recognized by
875 .Nm aslmanager .
876 .Pp
877 .Bl -tag -width "aslmanager_debug" -compact -offset indent
878 .It aslmanager_debug
879 Enables or disables internal debugging output.
880 This is probably of little interest to most users.
881 The debug parameter requires a value of
882 .Dq 1
883 to enable debug output, or a value of
884 .Dq 0
885 to disable it.
886 Debug messages saved in an auxiliary file attached to an ASL log message.
887 The file may be inspected by opening the file attachement from the Console utility.
888 .Pp
889 .It store_ttl
890 Sets the time-to-live in days for messages in the ASL database.
891 The default is 7 days.
892 .Pp
893 .It max_store_size
894 Sets the maximum size for for the ASL database.
895 The default is 150000000 bytes.
896 .Pp
897 .It archive
898 Enables or disables archiving of the ASL database.
899 The archive parameter requires a value of
900 .Dq 1
901 to enable archiving, or a value of
902 .Dq 0
903 to disable it.
904 An option archive directory path may follow the
905 .Dq 0
906 or
907 .Dq 1 .
908 If enabled, files removed from the ASL database are moved to the archive directory.
909 The default archive directory path is /var/log/asl.archive.
910 .Pp
911 .It store_path
912 The ASL database path used by
913 .Nm aslmanager .
914 The default is /var/log/asl.
915 Note that this parameter is ignored by
916 .Nm syslogd .
917 .Pp
918 .It archive_mode
919 Files copied to the ASL database archive will be given the specified access mode.
920 The default is 0400, so archive files will only be readable by root.
921 .El
922 .Pp
923 .Sh SEE ALSO
924 .Xr asl 3 ,
925 .Xr notify 3 ,
926 .Xr syslog 1 ,
927 .Xr aslmanager 8 ,
928 .Xr syslogd 8 .