Merge from vendor branch SENDMAIL:
[dragonfly.git] / usr.sbin / newsyslog / newsyslog.conf.5
1 .\" This file was split from the newsyslog(8) manual page by Tom Rhodes
2 .\" and includes modifications as appropriate.
3 .\" The original header is included below:
4 .\"
5 .\" This file contains changes from the Open Software Foundation.
6 .\"
7 .\"     from: @(#)newsyslog.8
8 .\" $FreeBSD: src/usr.sbin/newsyslog/newsyslog.conf.5,v 1.6 2006/09/29 17:57:03 ru Exp $
9 .\" $DragonFly: src/usr.sbin/newsyslog/newsyslog.conf.5,v 1.2 2007/09/14 23:47:53 swildner Exp $
10 .\"
11 .\" Copyright 1988, 1989 by the Massachusetts Institute of Technology
12 .\"
13 .\" Permission to use, copy, modify, and distribute this software
14 .\" and its documentation for any purpose and without fee is
15 .\" hereby granted, provided that the above copyright notice
16 .\" appear in all copies and that both that copyright notice and
17 .\" this permission notice appear in supporting documentation,
18 .\" and that the names of M.I.T. and the M.I.T. S.I.P.B. not be
19 .\" used in advertising or publicity pertaining to distribution
20 .\" of the software without specific, written prior permission.
21 .\" M.I.T. and the M.I.T. S.I.P.B. make no representations about
22 .\" the suitability of this software for any purpose.  It is
23 .\" provided "as is" without express or implied warranty.
24 .\"
25 .Dd May 2, 2007
26 .Dt NEWSYSLOG.CONF 5
27 .Os
28 .Sh NAME
29 .Nm newsyslog.conf
30 .Nd
31 .Xr newsyslog 8
32 configuration file
33 .Sh DESCRIPTION
34 The
35 .Nm
36 file is used to set log file rotation configuration for the
37 .Xr newsyslog 8
38 utility.
39 Configuration may designate that logs are rotated based on
40 size, last rotation time, or time of day.
41 The
42 .Nm
43 file can also be used to designate secure permissions to log
44 files at rotation time.
45 During initialization,
46 .Xr newsyslog 8
47 reads a configuration file,
48 normally
49 .Pa /etc/newsyslog.conf ,
50 to determine which logs may potentially be rotated and archived.
51 Each line has five mandatory fields and four optional fields,
52 separated with whitespace.
53 Blank lines or lines beginning with
54 .Ql #
55 are ignored.
56 If
57 .Ql #
58 is placed in the middle of the line, the
59 .Ql #
60 character and the rest of the line after it is ignored.
61 To prevent special meaning, the
62 .Ql #
63 character may be escaped with
64 .Ql \e\e ;
65 in this case preceding
66 .Ql \e\e
67 is removed and
68 .Ql #
69 is treated as an ordinary character.
70 The fields of the configuration file are as follows:
71 .Bl -tag -width indent
72 .It Ar logfile_name
73 Name of the system log file to be archived, or the literal string
74 .Dq Aq Li default .
75 The special default entry will only be used if a log file
76 name is given as a command line argument to
77 .Xr newsyslog 8 ,
78 and if that log file name is not matched by any other
79 line in the configuration file.
80 .It Ar owner : Ns Ar group
81 This optional field specifies the owner and group for the archive file.
82 The
83 .Ql \&:
84 is essential regardless if the
85 .Ar owner
86 or
87 .Ar group
88 field is left blank or contains a value.
89 The field may be numeric, or a name which is present in
90 .Pa /etc/passwd
91 or
92 .Pa /etc/group .
93 .It Ar mode
94 Specify the file mode of the log file and archives.
95 .It Ar count
96 Specify the maximum number of archive files which may exist.
97 This does not consider the current log file.
98 .It Ar size
99 When the size of the log file reaches
100 .Ar size
101 in kilobytes, the log file will be trimmed as described above.
102 If this field contains an asterisk
103 .Pq Ql * ,
104 the log file will not be trimmed based on size.
105 .It Ar when
106 The
107 .Ar when
108 field may consist of an interval, a specific time, or both.
109 If the
110 .Ar when
111 field contains an asterisk
112 .Pq Ql * ,
113 log rotation will solely depend on the contents of the
114 .Ar size
115 field.
116 Otherwise, the
117 .Ar when
118 field consists of an optional interval in hours, usually followed
119 by an
120 .So Li \&@ Sc Ns No -sign
121 and a time in restricted
122 .Tn ISO 8601
123 format.
124 Additionally, the format may also be constructed with a
125 .Ql $
126 sign along with a rotation time specification of once
127 a day, once a week, or once a month.
128 .Pp
129 If a time is specified, the log file will only be trimmed if
130 .Xr newsyslog 8
131 is run within one hour of the specified time.
132 If an interval is specified, the log file will be trimmed if that many
133 hours have passed since the last rotation.
134 When both a time and an interval are
135 specified then both conditions must be satisfied for the rotation to
136 take place.
137 .Pp
138 There is no provision for the specification of a timezone.
139 There is little point in specifying an explicit minutes or
140 seconds component in the current implementation, since the only comparison is
141 .Dq within the hour .
142 .Pp
143 .Sy ISO 8601 restricted time format :
144 .Pp
145 The lead-in character for a restricted
146 .Tn ISO 8601
147 time is an
148 .Ql @
149 sign.
150 The particular format of the time in restricted
151 .Tn ISO 8601
152 is:
153 .Sm off
154 .Oo
155 .Op Oo Oo Oo Va cc Oc Va yy Oc Va mm Oc Va dd
156 .Oo
157 .Li T
158 .Op Va hh Oo Va mm Oo Va ss Oc Oc Oc
159 .Oc .
160 .Sm on
161 Optional date fields default to the appropriate component of the
162 current date; optional time fields default to midnight; hence if today
163 is January 22, 1999, the following date specifications are all
164 equivalent:
165 .Pp
166 .Bl -item -compact -offset indent
167 .It
168 .Sq Li 19990122T000000
169 .It
170 .Sq Li 990122T000000
171 .It
172 .Sq Li 0122T000000
173 .It
174 .Sq Li 22T000000
175 .It
176 .Sq Li T000000
177 .It
178 .Sq Li T0000
179 .It
180 .Sq Li T00
181 .It
182 .Sq Li 22T
183 .It
184 .Sq Li T
185 .It
186 .Sq Li \&
187 .El
188 .Pp
189 .Sy Day, week, and month time format:
190 .Pp
191 The lead-in character for day, week, and month specification is a
192 .Ql $
193 sign.
194 The particular format of day, week, and month specification is:
195 .Op Li D Ns Va hh ,
196 .Op Li W Ns Va w Ns Op Li D Ns Va hh ,
197 and
198 .Op Li M Ns Va dd Ns Op Li D Ns Va hh ,
199 respectively.
200 Optional time fields default to midnight.
201 The ranges for day and hour specifications are:
202 .Pp
203 .Bl -tag -width indent -offset indent -compact
204 .It Ar hh
205 hours, range 0..23
206 .It Ar w
207 day of week, range 0..6, 0 = Sunday
208 .It Ar dd
209 day of month, range 1..31, or one of the letters
210 .Ql L
211 or
212 .Ql l
213 to specify the last day of the month.
214 .El
215 .Pp
216 Some examples:
217 .Pp
218 .Bl -tag -width indent -offset indent -compact
219 .It Li $D0
220 rotate every night at midnight
221 (same as
222 .Li @T00 )
223 .It Li $D23
224 rotate every day at 23:00
225 (same as
226 .Li @T23 )
227 .It Li $W0D23
228 rotate every week on Sunday at 23:00
229 .It Li $W5D16
230 rotate every week on Friday at 16:00
231 .It Li $M1D0
232 rotate at the first day of every month at midnight
233 (i.e., the start of the day; same as
234 .Li @01T00 )
235 .It Li $M5D6
236 rotate on every 5th day of month at 6:00
237 (same as
238 .Li @05T06 )
239 .El
240 .It Ar flags
241 This optional field is made up of one or more characters
242 that specify any special processing to be done for the log
243 files matched by this line.
244 The following are valid flags:
245 .Bl -tag -width indent
246 .It Cm B
247 indicates that the log file is a binary file, or has some
248 special format.
249 Usually
250 .Xr newsyslog 8
251 inserts an
252 .Tn ASCII
253 message into a log file during rotation.
254 This message is used to indicate
255 when, and sometimes why the log file was rotated.
256 If
257 .Cm B
258 is specified, then that informational message will not be
259 inserted into the log file.
260 .It Cm C
261 indicates that the log file should be created if it does not
262 already exist, and if the
263 .Fl C
264 option was also specified on the command line.
265 .It Cm D
266 indicates that
267 .Xr newsyslog 8
268 should set the
269 .Dv UF_NODUMP
270 flag when creating a new version of
271 this log file.
272 This option would affect how the
273 .Xr dump 8
274 command treats the log file when making a file system backup.
275 .It Cm G
276 indicates that the specified
277 .Ar logfile_name
278 is a shell pattern, and that
279 .Xr newsyslog 8
280 should archive all filenames matching that pattern using the
281 other options on this line.
282 See
283 .Xr glob 3
284 for details on syntax and matching rules.
285 .It Cm J
286 indicates that
287 .Xr newsyslog 8
288 should attempt to save disk space by compressing the rotated
289 log file using
290 .Xr bzip2 1 .
291 .It Cm N
292 indicates that there is no process which needs to be signaled
293 when this log file is rotated.
294 .It Cm U
295 indicates that the file specified by
296 .Ar path_to_pid_file
297 will contain the ID for a process group instead of a process.
298 This option also requires that the first line in that file
299 be a negative value to distinguish it from a process ID.
300 .It Cm Z
301 indicates that
302 .Xr newsyslog 8
303 should attempt to save disk space by compressing the rotated
304 log file using
305 .Xr gzip 1 .
306 .It Fl
307 a minus sign will not cause any special processing, but it
308 can be used as a placeholder to create a
309 .Ar flags
310 field when you need to specify any of the following fields.
311 .El
312 .It Ar path_to_pid_file
313 This optional field specifies the file name containing a daemon's
314 process ID or to find a group process ID if the
315 .Cm U
316 flag was specified.
317 If this field is present, a
318 .Ar signal_number
319 is sent the process ID contained in this file.
320 If this field is not present, then a
321 .Dv SIGHUP
322 signal will be sent to
323 .Xr syslogd 8 ,
324 unless the
325 .Cm N
326 flag has been specified.
327 This field must start with
328 .Ql /
329 in order to be recognized properly.
330 .It Ar signal_number
331 This optional field specifies the signal number that will be sent
332 to the daemon process (or to all processes in a process group, if the
333 .Cm U
334 flag was specified).
335 If this field is not present, then a
336 .Dv SIGHUP
337 signal will be sent.
338 .El
339 .Sh SEE ALSO
340 .Xr bzip2 1 ,
341 .Xr gzip 1 ,
342 .Xr syslog 3 ,
343 .Xr chown 8 ,
344 .Xr newsyslog 8 ,
345 .Xr syslogd 8
346 .Sh HISTORY
347 This manual page first appeared in
348 .Fx 4.10 .