]> CyberLeo.Net >> Repos - FreeBSD/releng/8.1.git/blob - usr.sbin/newsyslog/newsyslog.conf.5
Copy stable/8 to releng/8.1 in preparation for 8.1-RC1.
[FreeBSD/releng/8.1.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 November 27, 2006
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, or the literal string
73 .Dq Aq Li default .
74 The special default entry will only be used if a log file
75 name is given as a command line argument to
76 .Xr newsyslog 8 ,
77 and if that log file name is not matched by any other
78 line in the configuration file.
79 .It Ar owner : Ns Ar group
80 This optional field specifies the owner and group for the archive file.
81 The
82 .Ql \&:
83 is essential regardless if the
84 .Ar owner
85 or
86 .Ar group
87 field is left blank or contains a value.
88 The field may be numeric, or a name which is present in
89 .Pa /etc/passwd
90 or
91 .Pa /etc/group .
92 .It Ar mode
93 Specify the file mode of the log file and archives.
94 .It Ar count
95 Specify the maximum number of archive files which may exist.
96 This does not consider the current log file.
97 .It Ar size
98 When the size of the log file reaches
99 .Ar size
100 in kilobytes, the log file will be trimmed as described above.
101 If this field contains an asterisk
102 .Pq Ql * ,
103 the log file will not be trimmed based on size.
104 .It Ar when
105 The
106 .Ar when
107 field may consist of an interval, a specific time, or both.
108 If the
109 .Ar when
110 field contains an asterisk
111 .Pq Ql * ,
112 log rotation will solely depend on the contents of the
113 .Ar size
114 field.
115 Otherwise, the
116 .Ar when
117 field consists of an optional interval in hours, usually followed
118 by an
119 .So Li \&@ Sc Ns No -sign
120 and a time in restricted
121 .Tn ISO 8601
122 format.
123 Additionally, the format may also be constructed with a
124 .Ql $
125 sign along with a rotation time specification of once
126 a day, once a week, or once a month.
127 .Pp
128 If a time is specified, the log file will only be trimmed if
129 .Xr newsyslog 8
130 is run within one hour of the specified time.
131 If an interval is specified, the log file will be trimmed if that many
132 hours have passed since the last rotation.
133 When both a time and an interval are
134 specified then both conditions must be satisfied for the rotation to
135 take place.
136 .Pp
137 There is no provision for the specification of a timezone.
138 There is little point in specifying an explicit minutes or
139 seconds component in the current implementation, since the only comparison is
140 .Dq within the hour .
141 .Pp
142 .Sy ISO 8601 restricted time format :
143 .Pp
144 The lead-in character for a restricted
145 .Tn ISO 8601
146 time is an
147 .Ql @
148 sign.
149 The particular format of the time in restricted
150 .Tn ISO 8601
151 is:
152 .Sm off
153 .Oo
154 .Op Oo Oo Oo Va cc Oc Va yy Oc Va mm Oc Va dd
155 .Oo
156 .Li T
157 .Op Va hh Oo Va mm Oo Va ss Oc Oc Oc
158 .Oc .
159 .Sm on
160 Optional date fields default to the appropriate component of the
161 current date; optional time fields default to midnight; hence if today
162 is January 22, 1999, the following date specifications are all
163 equivalent:
164 .Pp
165 .Bl -item -compact -offset indent
166 .It
167 .Sq Li 19990122T000000
168 .It
169 .Sq Li 990122T000000
170 .It
171 .Sq Li 0122T000000
172 .It
173 .Sq Li 22T000000
174 .It
175 .Sq Li T000000
176 .It
177 .Sq Li T0000
178 .It
179 .Sq Li T00
180 .It
181 .Sq Li 22T
182 .It
183 .Sq Li T
184 .It
185 .Sq Li \&
186 .El
187 .Pp
188 .Sy Day, week, and month time format:
189 .Pp
190 The lead-in character for day, week, and month specification is a
191 .Ql $
192 sign.
193 The particular format of day, week, and month specification is:
194 .Op Li D Ns Va hh ,
195 .Op Li W Ns Va w Ns Op Li D Ns Va hh ,
196 and
197 .Op Li M Ns Va dd Ns Op Li D Ns Va hh ,
198 respectively.
199 Optional time fields default to midnight.
200 The ranges for day and hour specifications are:
201 .Pp
202 .Bl -tag -width indent -offset indent -compact
203 .It Ar hh
204 hours, range 0..23
205 .It Ar w
206 day of week, range 0..6, 0 = Sunday
207 .It Ar dd
208 day of month, range 1..31, or one of the letters
209 .Ql L
210 or
211 .Ql l
212 to specify the last day of the month.
213 .El
214 .Pp
215 Some examples:
216 .Pp
217 .Bl -tag -width indent -offset indent -compact
218 .It Li $D0
219 rotate every night at midnight
220 (same as
221 .Li @T00 )
222 .It Li $D23
223 rotate every day at 23:00
224 (same as
225 .Li @T23 )
226 .It Li $W0D23
227 rotate every week on Sunday at 23:00
228 .It Li $W5D16
229 rotate every week on Friday at 16:00
230 .It Li $M1D0
231 rotate at the first day of every month at midnight
232 (i.e., the start of the day; same as
233 .Li @01T00 )
234 .It Li $M5D6
235 rotate on every 5th day of month at 6:00
236 (same as
237 .Li @05T06 )
238 .El
239 .It Ar flags
240 This optional field is made up of one or more characters
241 that specify any special processing to be done for the log
242 files matched by this line.
243 The following are valid flags:
244 .Bl -tag -width indent
245 .It Cm B
246 indicates that the log file is a binary file, or has some
247 special format.
248 Usually
249 .Xr newsyslog 8
250 inserts an
251 .Tn ASCII
252 message into a log file during rotation.
253 This message is used to indicate
254 when, and sometimes why the log file was rotated.
255 If
256 .Cm B
257 is specified, then that informational message will not be
258 inserted into the log file.
259 .It Cm C
260 indicates that the log file should be created if it does not
261 already exist, and if the
262 .Fl C
263 option was also specified on the command line.
264 .It Cm D
265 indicates that
266 .Xr newsyslog 8
267 should set the
268 .Dv UF_NODUMP
269 flag when creating a new version of
270 this log file.
271 This option would affect how the
272 .Xr dump 8
273 command treats the log file when making a file system backup.
274 .It Cm G
275 indicates that the specified
276 .Ar logfile_name
277 is a shell pattern, and that
278 .Xr newsyslog 8
279 should archive all filenames matching that pattern using the
280 other options on this line.
281 See
282 .Xr glob 3
283 for details on syntax and matching rules.
284 .It Cm J
285 indicates that
286 .Xr newsyslog 8
287 should attempt to save disk space by compressing the rotated
288 log file using
289 .Xr bzip2 1 .
290 .It Cm N
291 indicates that there is no process which needs to be signaled
292 when this log file is rotated.
293 .It Cm U
294 indicates that the file specified by
295 .Ar path_to_pid_file
296 will contain the ID for a process group instead of a process.
297 This option also requires that the first line in that file
298 be a negative value to distinguish it from a process ID.
299 .It Cm Z
300 indicates that
301 .Xr newsyslog 8
302 should attempt to save disk space by compressing the rotated
303 log file using
304 .Xr gzip 1 .
305 .It Fl
306 a minus sign will not cause any special processing, but it
307 can be used as a placeholder to create a
308 .Ar flags
309 field when you need to specify any of the following fields.
310 .El
311 .It Ar path_to_pid_file
312 This optional field specifies the file name containing a daemon's
313 process ID or to find a group process ID if the
314 .Cm U
315 flag was specified.
316 If this field is present, a
317 .Ar signal_number
318 is sent the process ID contained in this file.
319 If this field is not present, then a
320 .Dv SIGHUP
321 signal will be sent to
322 .Xr syslogd 8 ,
323 unless the
324 .Cm N
325 flag has been specified.
326 This field must start with
327 .Ql /
328 in order to be recognized properly.
329 .It Ar signal_number
330 This optional field specifies the signal number that will be sent
331 to the daemon process (or to all processes in a process group, if the
332 .Cm U
333 flag was specified).
334 If this field is not present, then a
335 .Dv SIGHUP
336 signal will be sent.
337 .El
338 .Sh SEE ALSO
339 .Xr bzip2 1 ,
340 .Xr gzip 1 ,
341 .Xr syslog 3 ,
342 .Xr chown 8 ,
343 .Xr newsyslog 8 ,
344 .Xr syslogd 8
345 .Sh HISTORY
346 This manual page first appeared in
347 .Fx 4.10 .