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