]> git.saurik.com Git - apple/syslog.git/blame - util.tproj/syslog.1
syslog-385.tar.gz
[apple/syslog.git] / util.tproj / syslog.1
CommitLineData
81582353 1.\"Copyright (c) 2004-2012 Apple Inc. All rights reserved.
b16a592a 2.\"
57b0aad2 3.\"@APPLE_LICENSE_HEADER_START@
b16a592a 4.\"
57b0aad2
A
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.
b16a592a 11.\"
57b0aad2
A
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@
b16a592a
A
21.\"
22.Dd October 18, 2004
23.Dt SYSLOG 1
24.Os "Mac OS X"
25.Sh NAME
26.Nm syslog
27.Nd Apple System Log utility
28.Sh SYNOPSIS
29.Nm
30.Fl help
31.D1 ""
32.Nm
33.Fl s
34.Op Fl r Ar host
35.Op Fl l Ar level
36message...
37.D1 ""
38.Nm
39.Fl s
40.Op Fl r Ar host
41.Fl k
42key val
43.Op key val
44.Li ...
45.D1 ""
46.Nm
5dd30d76
A
47.Fl C
48.D1 ""
49.Nm
57b0aad2
A
50.Op Fl f Ar file ...
51.Op Fl d Ar dir ...
a83ff38a 52.Op Fl B
5dd30d76 53.Op Fl w Op Ar n
b16a592a 54.Op Fl F Ar format
5dd30d76 55.Op Fl T Ar format
57b0aad2 56.Op Fl E Ar format
b16a592a
A
57.Ar expression
58.D1 ""
59.Nm
57b0aad2
A
60.Op Fl f Ar file ...
61.Op Fl d Ar dir ...
62.Fl x Ar file Ar expression
b16a592a
A
63.D1 ""
64.Nm
5222c21d 65.Fl c Ar process Op mask
db78b1bd
A
66.D1 ""
67.Nm
68.Fl config Op options
81582353
A
69.D1 ""
70.Nm
71.Fl module
72.Op name Op action
b16a592a
A
73.Sh DESCRIPTION
74.Nm
57b0aad2 75is a command-line utility for a variety of tasks relating to the Apple System Log (ASL) facility.
b16a592a 76It provides mechanisms for sending and viewing log messages,
57b0aad2 77copying log messages to ASL format data store files,
b16a592a
A
78and for controlling the flow of log messages from client processes.
79.Pp
80When invoked with the
81.Fl help
82option,
83.Nm
84prints a usage message.
af7d442c
A
85.Pp
86NOTE: Most system logs have moved to a new logging system. See
87.Xr log 1
88for more information.
b16a592a
A
89.Ss SENDING MESSAGES
90The
91.Fl s
92option is used send log messages to the
93.Xr syslogd 8
94log message daemon,
95either locally or to a remote server if the
96.Fl r Ar host
97option in used.
98.Pp
99There are two main forms of the command.
100If the
101.Fl k
102option is used, then it must be followed by a list of keys and values.
103A structured message will be sent to the server with the keys and values given as arguments.
104If a key or a value has embedded white space, it must be enclosed in quotes.
105.Pp
57b0aad2
A
106Note that the text of the log message should be supplied as a value following the
107.Dq Message
108key.
109.Pp
b16a592a
A
110If the
111.Fl k
112option is not specified, then the rest of the command line is treated as the message text.
113The text may be preceded by
114.Fl l Ar level
115to set the log level (priority) of the message.
116Levels may be an integer value corresponding the the log levels specified in
117.Xr syslog 3
118or
119.Xr asl 3 ,
120or they may be a string.
121String values are case insensitive, and should be one of:
122.Pp
123.Bl -tag -compact
124.It Emergency
125(level 0)
126.It Alert
127(level 1)
128.It Critical
129(level 2)
130.It Error
131(level 3)
132.It Warning
133(level 4)
134.It Notice
135(level 5)
136.It Info
137(level 6)
138.It Debug
139(level 7)
140.El
141.Pp
142The string
143.Dq Panic
144is an alias for
145.Dq Emergency .
5dd30d76
A
146.Pp
147If the
148.Fl l
149option is omitted, the log level defaults to 7 (Debug).
150.Pp
b16a592a
A
151.Nm
152only requires one or two leading characters for a level specification.
153A single character suffices in most cases.
154Use
155.Dq P
156or
157.Dq \&Em
158for Panic / Emergency, and
159.Dq \&Er
160or
161.Dq X
162for Error).
163.Ss READING MESSAGES
164The
165.Nm syslogd
5dd30d76
A
166daemon filters and saves log messages to different output streams.
167One module saves messages to files specified in the
b16a592a
A
168.Xr syslog.conf 5
169file.
5dd30d76 170Those log files may be examined with any file printing or editing utility,
b16a592a
A
171e.g.
172.Pp
173.Dl cat /var/log/system.log
174.Pp
57b0aad2 175Another module saves messages in a data store (/var/log/asl).
b16a592a
A
176.Pp
177If invoked with no arguments,
178.Nm
db78b1bd 179fetches all messages from the active data store.
57b0aad2
A
180Messages are then printed to standard output,
181subject to formatting options and character encoding as described below.
182Some log messages are read-access controlled,
183so only messages that are readable by the user running
184.Nm
185will be fetched and printed.
5dd30d76
A
186.Pp
187If invoked with the
188.Fl C
189option,
190.Nm
191fetches and prints console messages.
192The
193.Fl C
194option is actually an alias for the expression:
195.Pp
196.Dl -k Facility com.apple.console
197.Pp
198See the EXPRESSIONS section below for more details.
199.Pp
57b0aad2
A
200Individual ASL data store files may be read by providing one or more file names as arguments to the
201.Fl f
202option.
203This may be useful when searching archived files, files on alternate disk volumes,
204or files created as export files with the
205.Fl x
206option.
207.Pp
208The
209.Fl d
210option may be followed by a list of directory paths.
5dd30d76 211.Nm
57b0aad2
A
212will read or search all ASL data store files in those directories.
213Any files that are not readable will be skipped.
214Specifying
215.Fl d
216with the name
217.Dq archive
218will open all readable files in the default ASL archive directory /var/log/asl.archive.
219Specifying
220.Fl d
221with the name
222.Dq store
223will open all readable files in the ASL store directory /var/log/asl.
224.Pp
225Legacy ASL database files that were written by
5dd30d76 226.Nm syslogd
57b0aad2
A
227on Mac OS X 10.5 (Leopard) may also be read using the
228.Fl f
5dd30d76 229option.
57b0aad2
A
230However only one such legacy database may be read or searched at a time.
231Note that a legacy database may be read and copied into a new ASL data store format file using a combination of
232.Fl f
233and
234.Fl x
235options.
5dd30d76
A
236.Pp
237The
a83ff38a
A
238.Fl B
239option causes
240.Nm
241to start processing messages beginning at the time of the last system startup.
242If used in conjunction with
243.Fl w ,
244all messages since the last system startup are displayed, or matched against an expression, before
245.Nm
246waits for new messages.
247.Pp
248The
b16a592a 249.Fl w
5dd30d76
A
250option causes
251.Nm
252to wait for new messages.
253By default,
b16a592a 254.Nm
5dd30d76 255prints the last 10 messages,
57b0aad2 256then waits for new messages to be added to the data store.
5dd30d76
A
257A number following the
258.Fl w
259option specifies the number of messages to print and overrides the default value of 10.
260For example:
261.Pp
262.Dl syslog -w 20
263.Pp
a83ff38a
A
264Use the value
265.Dq all
266to view all messages in the data store before watching for new messages.
267The value
268.Dq boot
269will display messages since the last system startup before watching for new messages.
270Specifying
271.Dq -w boot
272is equivalent to using
273.Fl w
274and
275.Fl B
276together.
277.Pp
278Using
279.Nm
280with the
281.Fl w
282option is similar to watching a log file using, e.g.
b16a592a
A
283.Pp
284.Dl tail -f /var/log/system.log
285.Pp
5dd30d76
A
286The
287.Fl w
57b0aad2
A
288option can only be used when reading the system's ASL data store or when reading a single data store file,
289and when printing messages to standard output.
b16a592a 290.Pp
5dd30d76 291If the
57b0aad2
A
292.Fl x Ar file
293option is specified, messages are copied to the named file rather than being printed.
294The file will be created if it does not exist.
5dd30d76
A
295.Pp
296When called without the
297.Fl x
298option, messages are printed to standard output.
299Messages are printed in a format similar to that used in the system.log file,
300except that the message priority level is printed between angle-brackets.
b16a592a
A
301.Pp
302The output format may by changed by specifying the
303.Fl F Ar format
304option.
57b0aad2
A
305Non-printable and control characters are encoded by default.
306Text encoding may be controlled using the
307.Fl E
308option (see below).
b16a592a
A
309The value of
310.Ar format
311may be one of the following:
312.Pp
313.Bl -tag -width "xxxx"
314.It bsd
315Format used by the
316.Nm syslogd
317daemon for system log files, e.g. /var/log/system.log.
318.It std
319Standard (default) format.
320Similar to
321.Dq bsd ,
322but includes the message priority level.
323.It raw
324Prints the complete message structure.
325Each key/value pair is enclosed in square brackets.
326Embedded closing brackets and white space are escaped.
5dd30d76
A
327Time stamps are printed as seconds since the epoch by default, but may also be
328printed in local time or UTC if the
329.Fl T
330option is specified (see below).
331.It xml
332The list of messages is printed as an XML property list.
333Each message is represented as a dictionary in a array.
334Dictionary keys represent message keys.
335Dictionary values are strings.
b16a592a
A
336.El
337.Pp
81582353
A
338Each of the format styles above may optionally be followed by a dot character and an integer value, for example:
339.Pp
340.Dl syslog -F std.4
341.Pp
342This causes sub-second time values to be printed.
343In the example above, 4 decimal digits would be printed.
344The sub-second time values come from the value of the TimeNanoSec key in the ASL message.
345If the TimeNanoSec key is missing, a value of zero is used.
346.Pp
b16a592a
A
347The value of the
348.Ar format
349argument may also be a custom print format string.
350A custom format should in most cases be enclosed in single quotes to prevent the shell from substituting
351special characters and breaking at white space.
352.Pp
353Custom format strings may include variables of the form
db78b1bd
A
354.Dq $Name ,
355.Dq $(Name) ,
356or
357.Dq $((Name)(format)) .
358which will be expanded to the value associated with the named key.
b16a592a
A
359For example, the command:
360.Pp
db78b1bd 361.Dl syslog -F '$Time $Host $(Sender)[$(PID)] <$((Level)(str))>: $Message'
b16a592a
A
362.Pp
363produces output similar to the
db78b1bd 364.Dq std
b16a592a 365format.
db78b1bd
A
366The simple
367.Dq $Name
368form is sufficient in most cases.
369However, the second form:
370.Dq $(Name)
371must be used if the name is not delimited by white space.
372The third form allows different formats of the value to be printed.
373For example, a message priority level may appear as an integer value (e.g.
374.Dq 3 )
375or as a string (``Error'').
376The following print formats are known.
377.Pp
378.Bl -tag -width "$((Time)([+|-]HH[:MM]))"
379.It $((Level)(str))
380Formats a Level value as a string, for example
381.Dq Error ,
382.Dq Alert ,
383.Dq Warning ,
384and so on.
385Note that $(Level) or $Level formats the value as an integer 0 through 7.
386.It $((Time)(sec))
387Formats a Time value as the number of seconds since the Epoch.
388.It $((Time)(raw))
389Alias for $((Time)(sec)).
390.It $((Time)(local))
391Formats a Time value as a string of the form
392.Dq "Mmm dd hh:mm:ss" ,
393where Mmm is the abbreviation for the month, dd is the date (1 - 31) and hh:mm:ss is the time.
394The local timezone is used.
395.It $((Time)(lcl))
396Alias for $((Time)(local)).
397.It $((Time)(utc))
398Formats a Time value as a string of the form
399.Dq "yyyy-mm-dd hh:mm:ssZ" ,
400using Coordinated Universal Time, or the
401.Dq Zulu
402time zone.
403.It $((Time)(zulu))
404Alias for $((Time)(utc)).
405.It $((Time)(X))
406Where X may be any letter in the range A - Z or a - z.
407Formats the Time using the format
408.Dq "yyyy-mm-dd hh:mm:ssX" ,
409using the specified nautical timezone.
410Z is the same as UTC/Zulu time. Timezones A - M (except J) decrease by one hour to the east of the
411Zulu time zone.
412Timezones N - Y increase by one hour to the west of Z.
413M and Y have the same clock time, but differ by one day.
414J is used to indicate the local timezone.
415When printing using $((Time)(J)), the output format is
416.Dq "yyyy-mm-dd hh:mm:ss" ,
417without a trailing timezone letter.
81582353
A
418.It $((Time)(JZ))
419Specifies the local timezone.
420The timezone offset from UTC follows the date and time.
421The time is formatted as
422.Dq "yyyy-mm-dd hh:mm:ss[+|-]HH[:MM]" .
423Minutes in the timezone offset are only printed if they are non-zero.
424.It $((Time)(ISO8601))
425Specifies the local timezone and ISO 8601 extended format.
426The timezone offset from UTC follows the date and time.
427The time is formatted as
428.Dq "yyyy-mm-ddThh:mm:ss[+|-]HH[:MM]" .
429Minutes in the timezone offset are only printed if they are non-zero.
430Note that this differs from
431.Dq JZ
432format only in that a
433.Dq T
434character separates the date and time.
435.It $((Time)(ISO8601B))
436Specifies the local timezone and ISO 8601 basic format, in the form:
437.Dq "yyyymmddThhmmss[+|-]HH[:MM]" .
438.It $((Time)(ISO8601Z))
439Specifies UTC/Zulu time and ISO 8601 extended format, in the form:
440.Dq "yyyy-mm-ddThh:mm:ssZ" .
441.It $((Time)(ISO8601BZ))
442Specifies UTC/Zulu time and ISO 8601 basic format, in the form:
443.Dq "yyyymmddThhmmssZ" .
db78b1bd
A
444.It $((Time)([+|-]HH[:MM]))
445Specifies an offset (+ or -) of the indicated number of hours (HH) and optionally minutes (MM) to UTC.
446The value is formatted as a string of the form
81582353
A
447.Dq "yyyy-mm-dd hh:mm:ss[+|-]HH[:MM]" .
448Minutes in the timezone offset are only printed if they are non-zero.
db78b1bd 449.El
b16a592a 450.Pp
81582353
A
451Each of the print formats listed above for Time values may optionally be followed by a dot character and an integer value.
452In that case, sub-second time values will be printed.
453For example, the following line prints messages with a UTC time format, and includes 6 digits of sub-second time:
454.Pp
455.Dl syslog -F '$((Time)(utc.6)) $Host $(Sender)[$(PID)] <$((Level)(str))>: $Message
456.Pp
db78b1bd
A
457If a custom format is not being used to specify the format for Time values, then Time values
458are generally converted to local time, except when the
459.Fl F Ar raw
5dd30d76
A
460option is used, in which case times are printed as the number of seconds since the epoch.
461The
462.Fl T Ar format
db78b1bd 463option may be used to control the format used for timestamps.
5dd30d76
A
464The value of
465.Ar format
466may be one of the following:
467.Pp
db78b1bd
A
468.Bl -tag -width "local or lcl"
469.It sec or raw
5dd30d76 470Times are printed as the number of seconds since the epoch.
db78b1bd 471.It local or lcl
5dd30d76 472Times are converted to the local time zone, and printed with the format
db78b1bd
A
473.Dl mmm dd hh:mm:ss
474where mmm is the month name abbreviated as three characters.
475.It utc or zulu
5dd30d76 476Times are converted to UTC, and printed with the format
db78b1bd
A
477.Dl yyyy-mm-dd hh:mm:ssZ
478.It A-Z
479Times are converted to the indicated nautical time zone,
480printed in the same format as UTC.
481.Dq J
482is interpreted as the local timezone and printed in the same format,
483but without a trailing timezone letter.
81582353
A
484.It JZ
485is interpreted as the local timezone and printed with the format
486.Dl yyyy-mm-dd hh:mm:ss[+|-]HH[:MM] .
487The trailing
488.Dq [+|-]HH[:MM]
489string represents the local timezone offset from UTC in hours,
490or in hours and minutes if minutes are non-zero.
491.It ISO8601
492Times are printed with the format specified by ISO 8601:
493.Dl yyyy-mm-ddThh:mm:ss[+|-]HH[:MM] .
494This is the same as the
495.Dq JZ
496format, except a
497.Dq T character separates the date and time components.
db78b1bd
A
498.It [+|-]hh[:mm]
499The specified offset is used to adjust time.
5dd30d76
A
500.El
501.Pp
81582353
A
502Each of the time formats above may optionally be followed by a dot character and an integer value.
503In that case, sub-second time values will be printed.
504For example:
505.Pp
506.Dl syslog -T bsd.3
507.Pp
5dd30d76
A
508The
509.Fl u
510option is a short form for
511.Fl T Ar utc .
512.Pp
57b0aad2
A
513By default, control characters and non-printable characters are encoded in the output stream.
514In some cases this may make messages less natural in appearance.
515The encoding is designed to preserve all the information in the log message,
db78b1bd 516and to prevent malicious users from spoofing or obscuring information in log messages.
5dd30d76 517.Pp
57b0aad2 518Text in the
5dd30d76
A
519.Dq std ,
520.Dq bsd ,
521and
522.Dq raw
523formats is encoded as it is by the
57b0aad2 524.Nm vis
5dd30d76
A
525utility with the
526.Fl c
527option.
528Newlines and tabs are also encoded as "\\n" and "\\t" respectively.
529In
530.Dq raw
57b0aad2 531format, space characters embedded in log message keys are encoded as "\\s"
5dd30d76
A
532and embedded brackets are escaped to print as "\\[" and "\\]".
533.Pp
534XML format output requires that keys are valid UTF8 strings.
535Keys which are not valid UTF8 are ignored, and the associated value is not printed.
536.Pp
537Values that contain legal UTF8 are printed as strings.
538Ampersand, less than, greater than, quotation mark, and apostrophe characters are encoded according to XML conventions.
539Embedded control characters are encoded as
540.Dq &#xNN;
db78b1bd 541where NN is the character's hexadecimal value.
5dd30d76
A
542.Pp
543Values that do not contain legal UTF8 are encoded in base-64 and printed as data objects.
544.Pp
57b0aad2
A
545The
546.Fl E Ar format
db78b1bd 547option may be used to explicitly control the text encoding.
57b0aad2
A
548The value of
549.Ar format
550may be one of the following:
551.Pp
552.Bl -tag -width "safe"
57b0aad2 553.It safe
f3df4c03
A
554This is the default encoding for
555.Nm syslog
556output.
57b0aad2
A
557Encodes backspace characters as ^H.
558Carriage returns are mapped to newlines.
559A tab character is appended after newlines so that message text is indented.
f3df4c03
A
560.It vis
561The C-style backslash encoding similar to that produced by the
562.Dq vis -c
563command, as described above.
57b0aad2
A
564.It none
565No encoding is used.
566.El
567.Pp
568The intent of the
569.Dq safe
570encoding is to prevent obvious message spoofing or damage.
571The appearance of messages printed will depend on terminal settings and UTF-8 string handling.
572It is possible that messages printed using the
573.Dq safe
574or
575.Dq none
576options may be garbled or subject to manipulation through the use of control characters and control sequences
577embedded in user-supplied message text.
f3df4c03 578The
57b0aad2
A
579.Dq vis
580encoding should be used to view messages if there is any suspicion
581that message text may have been used to manipulate the printed representation.
582.Pp
b16a592a
A
583If no further command line options are specified,
584.Nm
57b0aad2 585displays all messages, or copies all messages to a data store file.
b16a592a
A
586However, an expression may be specified using the
587.Fl k
588and
589.Fl o
590options.
591.Ss EXPRESSIONS
592Expressions specify matching criteria.
5dd30d76 593They may be used to search for messages of interest.
b16a592a 594.Pp
57b0aad2
A
595A simple expression
596has the form:
597.Pp
598.Dl -k key [[op] val]
599.Pp
600The
601.Fl k
602option may be followed by one, two, or three arguments.
603A single argument causes a match to occur if a message has the specified key, regardless of value.
604If two arguments are specified, a match occurs when a message has exactly the specified value for a given key.
5dd30d76 605For example, to find all messages sent by the portmap process:
b16a592a
A
606.Pp
607.Dl syslog -k Sender portmap
608.Pp
5dd30d76
A
609Note that the
610.Fl C
611option is treated as an alias for the expression:
612.Pp
613.Dl -k Facility com.apple.console
614.Pp
615This provides a quick way to search for console messages.
616.Pp
b16a592a
A
617If three arguments are given, they are of the form
618.Fl k Ar key operation value .
619.Nm
620supports the following matching operators:
621.Pp
622.Bl -tag -width "xxx" -compact
623.It eq
624equal
625.It ne
626not equal
627.It gt
628greater than
629.It ge
630greater than or equal to
631.It lt
632less than
633.It le
634less than or equal to
635.El
636.Pp
637Additionally, the operator may be preceded by one or more of the following modifiers:
638.Pp
639.Bl -tag -width "xxx" -compact
640.It C
641case-fold
642.It R
643regular expression (see
644.Xr regex 3 )
645.It S
646substring
647.It A
648prefix
649.It Z
650suffix
651.It N
652numeric comparison
653.El
654.Pp
57b0aad2
A
655More complex search expressions may be built by combining two or more simple expressions.
656A complex expression that has more than one
657.Dq -k key [[op] val]
658term matches a message if all of the key-value operations match.
b16a592a 659Logically, the result is an AND of all of key-value operations.
57b0aad2
A
660For example:
661.Pp
662.Dl syslog -k Sender portmap -k Time ge -2h
663.Pp
664finds all messages sent by portmap in the last 2 hours
665(-2h means "two hours ago").
666.Pp
b16a592a
A
667The
668.Fl o
57b0aad2
A
669option may be used to build even more complex searches by providing an OR operation.
670If two or more sub-expressions are given, separated by
b16a592a 671.Fl o
57b0aad2 672options, then a match occurs is a message matches any of the sub-expressions.
b16a592a
A
673For example, to find all messages which have either a
674.Dq Sender
675value of
676.Dq portmap
677or that have a numeric priority level of 4 or less:
678.Pp
679.Dl syslog -k Sender portmap -o -k Level Nle 4
680.Pp
c4fdb7d1
A
681Log priority levels are internally handled as an integer value between 0 and 7.
682Level values in expressions may either be given as integers, or as string equivalents.
683See the table string values in the SENDING MESSAGES section for details.
684The example query above could also be specified with the command:
685.Pp
686.Dl syslog -k Sender portmap -o -k Level Nle warning
687.Pp
688.Pp
b16a592a
A
689A special convention exists for matching time stamps.
690An unsigned integer value is regarded as the given number of seconds since
6910 hours, 0 minutes, 0 seconds, January 1, 1970, Coordinated Universal Time.
692An negative integer value is regarded as the given number of seconds before the current time.
c4fdb7d1 693For example, to find all messages of Error priority level (3) or less which were logged in the last 30 seconds:
b16a592a 694.Pp
c4fdb7d1 695.Dl syslog -k Level Nle error -k Time ge -30
b16a592a
A
696.Pp
697a relative time value may be optionally followed by one of the characters
698.Dq s ,
699.Dq m ,
700.Dq h ,
701.Dq d ,
702or
703.Dq w
704to specify seconds, minutes, hours, days, or weeks respectively.
705Upper case may be used equivalently.
706A week is taken to be 7 complete days (i.e. 604800 seconds).
b16a592a
A
707.Ss FILTERING CONTROLS
708Clients of the Apple System Log facility using either the
709.Xr asl 3
710or
711.Xr syslog 3
712interfaces may specify a log filter mask.
713The mask specifies which messages should be sent to the
714.Nm syslogd
715daemon by specifying a yes/no setting for each priority level.
716Many clients set a filter mask to avoid sending relatively unimportant messages.
717Debug or Info priority level messages are generally only useful for debugging operations.
718By setting a filter mask, a process can improve performance by avoiding spending
719time sending messages that are in most cases unnecessary.
720.Pp
721The
722.Fl c
723option may be used to control filtering.
5222c21d 724In addition to the internal filter mask value that processes may set as described above,
b16a592a
A
725the system maintains a global
726.Dq master
5222c21d 727filter mask.
b16a592a
A
728This filter is normally
729.Dq off ,
730meaning that it has no effect.
5222c21d
A
731If a value is set for the master filter mask, it overrides the local filter mask for all processes.
732Root user access is required to set the master filter mask value.
b16a592a
A
733.Pp
734The current setting of the master filter mask may be inspected using:
735.Pp
736.Dl syslog -c 0
737.Pp
738The value of the master filter mask my be set by providing a second argument following
739.Fl c Ar 0 .
740The value may a set of characters from the set
741.Dq pacewnid .
742These correspond to the priority levels Emergency (Panic), Alert, Critical, Error, Warning, Notice, Info, and Debug.
743The character
744.Dq x
745may be used for Error, as it is used for sending messages.
5222c21d 746The master filter mask may be deactivated with:
b16a592a
A
747.Pp
748.Dl syslog -c 0 off
749.Pp
5222c21d 750Since it is common to use the filter mask as a
b16a592a
A
751.Dq cutoff
752mechanism, for example to cut off messages with Debug and Info priority,
753a single character from the list above may be specified, preceded by a minus sign.
754In this case,
755.Nm
756uses a filter mask starting at level 0 (Emergency)
757.Dq up to
758the given level.
5222c21d 759For example, to set the master filter mask to cause all processes to log messages from Emergency up to Debug:
b16a592a
A
760.Pp
761.Dl syslog -c 0 -d
762.Pp
5222c21d 763While the master filter mask may be set to control the messages produced by all processes,
b16a592a
A
764another filter mask may be specified for an individual process.
765If a per-process filter mask is set, it overrides both the local filter mask and the master filter mask.
766The current setting for a per-process filter mask may be inspected using
767.Fl c Ar process ,
768where
769.Ar process
770is either a PID or the name of a process.
771If a name is used, it must uniquely identify a process.
772To set a per-process filter mask, an second argument may be supplied following
773.Fl c Ar process
774as described above for the master filter mask.
775Root access is required to set the per-process filter mask for system (UID 0) processes.
776.Pp
db78b1bd 777The
b16a592a 778.Nm syslogd
db78b1bd
A
779server follows filtering rules specified in the /etc/asl.conf file.
780When the remote-control mechanism is used to change the filter of a process,
781.Nm syslogd
782will save any messages received from that process until the remote-control filter is turned off.
783.Ss SERVER CONFIGURATION
784When
785.Nm syslogd
786starts up, and when it receives a HUP signal, it re-reads its configuration settings from /etc/asl.conf.
787It is sometimes useful to change configuration parameters temporarily, without needing to make changes
788to the configuration file.
789Any of the configuration options that may be set in the file (following an ``='' character) may also
790be sent to syslogd using the
791.Fl config
792flag (without an ``='' character).
81582353 793For example, to temporarily disable the kernel message-per-second limit:
b16a592a 794.Pp
db78b1bd 795.Dl syslog -config mps_limit 0
b16a592a 796.Pp
db78b1bd 797Note that only the superuser (root) may change configuration parameters.
b16a592a 798.Pp
db78b1bd
A
799In addition to the parameter setting options that are described in the
800.Xr asl.conf 5
801manual page, an additional option:
b16a592a 802.Pp
db78b1bd 803.Dl syslog -config reset
c4fdb7d1 804.Pp
db78b1bd 805will cause
c4fdb7d1 806.Nm syslogd
db78b1bd 807to reset its configuration.
81582353
A
808.Ss ASL OUTPUT MODULES
809ASL Output Modules are named configuration bundles used by the ASL server
810.Nm syslogd ,
811and by the ASL filesystem manager
812.Nm aslmanager .
813The /etc/asl.conf file represents the system's primary output module,
814and is given the name
815.Dq com.apple.asl .
816Other modules are read from files in the /etc/asl directory.
817File names serve as module names.
818ASL Output Modules are described in detail in
819.Xr asl.conf 5 .
820.Pp
821When invoked with
822.Fl module ,
823.Nm syslog
824prints a summary of all loaded ASL Output Modules.
825The summary includes the output files and ASL store directories used by each module,
826a list of the module's configuration rules, and the module's current enabled or disabled status.
827.Fl module Ar name
828prints a summary for the module with the given name.
829.Pp
830ASL Output Modules may be enabled or disabled using the command:
831.Pp
832 syslog -module
833.Ar name
834enable
835.Op 0
836.Pp
837Note that only the superuser (root) may enable or disable a module.
838.Pp
839The name '*'
840(including the single-quote characters)
841may be used to change the status of all ASL Output Modules,
842excluding the primary com.apple.asl module.
843com.apple.asl may be enabled or disabled, but only specifically by name.
844.Pp
845If a module includes rotated files, the command:
846.Pp
847 syslog -module
848.Ar name
849checkpoint
850.Op file
851.Pp
852Will force the module to checkpoint all of its rotated files,
853or just the single optionally named file.
854The name '*'
855(including the single-quote characters)
856may be used to force checkpointing of all rotated files for all ASL Output Modules,
857including the primary com.apple.asl module.
858.Pp
859Note that only the superuser (root) may force files to be checkpointed.
860.Pp
861The checkpoint action sends a command to
862.Nm syslogd
863and waits for a reply to be returned.
864This means that any files currently in use will be checkpointed when the
865.Nm syslog
866command completes.
b16a592a 867.Sh SEE ALSO
af7d442c 868.Xr log 1 ,
b16a592a
A
869.Xr logger 1 ,
870.Xr asl 3 ,
871.Xr syslog 3 ,
af7d442c
A
872.Xr asl.conf 5 ,
873.Xr syslogd 8
b16a592a
A
874.Sh HISTORY
875The
876.Nm
877utility appeared in Mac OS X 10.4.