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