]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - usr.sbin/newsyslog/newsyslog.conf.5
sysctl(9): Fix a few mandoc related issues
[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 .\"     from: @(#)newsyslog.8
8 .\" $FreeBSD$
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 August 21, 2018
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 Valid mode bits are
100 .Dv 0666 .
101 (That is, read and write permissions for the rotated log may be specified for
102 the owner, group, and others.)
103 All other mode bits are ignored.
104 .It Ar count
105 Specify the maximum number of archive files which may exist.
106 This does not consider the current log file.
107 .It Ar size
108 When the size of the log file reaches
109 .Ar size
110 in kilobytes, the log file will be trimmed as described above.
111 If this field contains an asterisk
112 .Pq Ql * ,
113 the log file will not be trimmed based on size.
114 .It Ar when
115 The
116 .Ar when
117 field may consist of an interval, a specific time, or both.
118 If the
119 .Ar when
120 field contains an asterisk
121 .Pq Ql * ,
122 log rotation will solely depend on the contents of the
123 .Ar size
124 field.
125 Otherwise, the
126 .Ar when
127 field consists of an optional interval in hours, usually followed
128 by an
129 .So Li \&@ Sc Ns No -sign
130 and a time in restricted
131 .Tn ISO 8601
132 format.
133 Additionally, the format may also be constructed with a
134 .Ql $
135 sign along with a rotation time specification of once
136 a day, once a week, or once a month.
137 .Pp
138 Time based trimming happens only if
139 .Xr newsyslog 8
140 is run within one hour of the specified time.
141 If an interval is specified, the log file will be trimmed if that many
142 hours have passed since the last rotation.
143 When both a time and an interval are
144 specified then both conditions must be satisfied for the rotation to
145 take place.
146 .Pp
147 There is no provision for the specification of a timezone.
148 There is little point in specifying an explicit minutes or
149 seconds component in the current implementation, since the only comparison is
150 .Dq within the hour .
151 .Pp
152 .Sy ISO 8601 restricted time format :
153 .Pp
154 The lead-in character for a restricted
155 .Tn ISO 8601
156 time is an
157 .Ql @
158 sign.
159 The particular format of the time in restricted
160 .Tn ISO 8601
161 is:
162 .Sm off
163 .Oo Oo Oo Oo Oo
164 .Va cc Oc
165 .Va yy Oc
166 .Va mm Oc
167 .Va dd Oc
168 .Oo
169 .Li T Oo
170 .Va hh Oo
171 .Va mm Oo
172 .Va ss
173 .Oc Oc Oc Oc Oc .
174 .Sm on
175 Optional date fields default to the appropriate component of the
176 current date; optional time fields default to midnight; hence if today
177 is January 22, 1999, the following date specifications are all
178 equivalent:
179 .Pp
180 .Bl -item -compact -offset indent
181 .It
182 .Sq Li 19990122T000000
183 .It
184 .Sq Li 990122T000000
185 .It
186 .Sq Li 0122T000000
187 .It
188 .Sq Li 22T000000
189 .It
190 .Sq Li T000000
191 .It
192 .Sq Li T0000
193 .It
194 .Sq Li T00
195 .It
196 .Sq Li 22T
197 .It
198 .Sq Li T
199 .It
200 .Sq Li \&
201 .El
202 .Pp
203 .Sy Day, week, and month time format:
204 .Pp
205 The lead-in character for day, week, and month specification is a
206 .Ql $
207 sign.
208 The particular format of day, week, and month specification is:
209 .Op Li D Ns Va hh ,
210 .Op Li W Ns Va w Ns Op Li D Ns Va hh ,
211 and
212 .Op Li M Ns Va dd Ns Op Li D Ns Va hh ,
213 respectively.
214 Optional time fields default to midnight.
215 The ranges for day and hour specifications are:
216 .Pp
217 .Bl -tag -width indent -offset indent -compact
218 .It Ar hh
219 hours, range 0..23
220 .It Ar w
221 day of week, range 0..6, 0 = Sunday
222 .It Ar dd
223 day of month, range 1..31, or one of the letters
224 .Ql L
225 or
226 .Ql l
227 to specify the last day of the month.
228 .El
229 .Pp
230 Some examples:
231 .Pp
232 .Bl -tag -width indent -offset indent -compact
233 .It Li $D0
234 rotate every night at midnight
235 (same as
236 .Li @T00 )
237 .It Li $D23
238 rotate every day at 23:00
239 (same as
240 .Li @T23 )
241 .It Li $W0D23
242 rotate every week on Sunday at 23:00
243 .It Li $W5D16
244 rotate every week on Friday at 16:00
245 .It Li $M1D0
246 rotate at the first day of every month at midnight
247 (i.e., the start of the day; same as
248 .Li @01T00 )
249 .It Li $M5D6
250 rotate on every fifth day of month at 6:00
251 (same as
252 .Li @05T06 )
253 .El
254 .It Ar flags
255 This optional field is made up of one or more characters
256 that specify any special processing to be done for the log
257 files matched by this line.
258 The following are valid flags:
259 .Bl -tag -width indent
260 .It Cm B
261 indicates that the log file is a binary file, or has some
262 special format.
263 Usually
264 .Xr newsyslog 8
265 inserts an
266 .Tn ASCII
267 message into a log file during rotation.
268 This message is used to indicate
269 when, and sometimes why the log file was rotated.
270 If
271 .Cm B
272 is specified, then that informational message will not be
273 inserted into the log file.
274 .It Cm C
275 indicates that the log file should be created if it does not
276 already exist, and if the
277 .Fl C
278 option was also specified on the command line.
279 .It Cm D
280 indicates that
281 .Xr newsyslog 8
282 should set the
283 .Dv UF_NODUMP
284 flag when creating a new version of
285 this log file.
286 This option would affect how the
287 .Xr dump 8
288 command treats the log file when making a file system backup.
289 .It Cm G
290 indicates that the specified
291 .Ar logfile_name
292 is a shell pattern, and that
293 .Xr newsyslog 8
294 should archive all filenames matching that pattern using the
295 other options on this line.
296 See
297 .Xr glob 3
298 for details on syntax and matching rules.
299 .It Cm J
300 indicates that
301 .Xr newsyslog 8
302 should attempt to save disk space by compressing the rotated
303 log file using
304 .Xr bzip2 1 .
305 .It Cm N
306 indicates that there is no process which needs to be signaled
307 when this log file is rotated.
308 .It Cm p
309 indicates that the zero-th rotated file should not be compressed.
310 .It Cm R
311 if this flag is set the
312 .Xr newsyslog 8
313 will run shell command defined in
314 .Ar path_to_pid_cmd_file
315 after rotation instead of trying to send signal to a process id
316 stored in the file.
317 .It Cm T
318 if this flag is set the informational rotation message written to
319 the log file will be in the format specified by RFC5424.
320 Normally, the rotation message is written in the traditional (RFC3164)
321 syslog format.
322 .It Cm U
323 indicates that the file specified by
324 .Ar path_to_pid_cmd_file
325 will contain the ID for a process group instead of a process.
326 This option also requires that the first line in that file
327 be a negative value to distinguish it from a process ID.
328 .It Cm X
329 indicates that
330 .Xr newsyslog 8
331 should attempt to save disk space by compressing the rotated
332 log file using
333 .Xr xz 1 .
334 .It Cm Y
335 indicates that
336 .Xr newsyslog 8
337 should attempt to save disk space by compressing the rotated
338 log file using
339 .Xr zstd 1 .
340 .It Cm Z
341 indicates that
342 .Xr newsyslog 8
343 should attempt to save disk space by compressing the rotated
344 log file using
345 .Xr gzip 1 .
346 .It Fl
347 a minus sign will not cause any special processing, but it
348 can be used as a placeholder to create a
349 .Ar flags
350 field when you need to specify any of the following fields.
351 .El
352 .It Ar path_to_pid_cmd_file
353 This optional field specifies the file name containing a daemon's
354 process ID or to find a group process ID if the
355 .Cm U
356 flag was specified.
357 If this field is present, a
358 .Ar signal
359 is sent to the process ID contained in this file.
360 If this field is not present and the
361 .Cm N
362 flag has not been specified, then a
363 .Dv SIGHUP
364 signal will be sent to
365 .Xr syslogd 8
366 or to the process id found in the file specified by
367 .Xr newsyslog 8 Ns 's
368 .Fl S
369 switch.
370 This field must start with
371 .Ql /
372 in order to be recognized properly.
373 When used with the
374 .Cm R
375 flag, the file is treated as a path to a binary to be executed
376 by the
377 .Xr newsyslog 8
378 after rotation instead of sending the signal out.
379 .It Ar signal
380 This optional field specifies the signal that will be sent to the daemon
381 process (or to all processes in a process group, if the
382 .Cm U
383 flag was specified).
384 If this field is not present, then a
385 .Dv SIGHUP
386 signal will be sent.
387 Signal names
388 must start with
389 .Dq SIG
390 and be the signal name, e.g.,
391 .Dv SIGUSR1 .
392 Alternatively,
393 .Ar signal
394 can be the signal number, e.g., 30 for
395 .Dv SIGUSR1 .
396 .El
397 .Sh EXAMPLES
398 The following is an example of the
399 .Dq Aq Li include
400 entry:
401 .Dl "<include> /etc/newsyslog-local.conf"
402 .Sh SEE ALSO
403 .Xr bzip2 1 ,
404 .Xr gzip 1 ,
405 .Xr xz 1 ,
406 .Xr syslog 3 ,
407 .Xr chown 8 ,
408 .Xr newsyslog 8 ,
409 .Xr syslogd 8
410 .Pp
411 .Rs
412 .%A C. Lonvick
413 .%T The BSD syslog Protocol
414 .%O RFC3164
415 .Re
416 .Rs
417 .%A R. Gerhards
418 .%T The Syslog Protocol
419 .%O RFC5424
420 .Re
421 .Sh HISTORY
422 This manual page first appeared in
423 .Fx 4.10 .