1 .\" $NetBSD: newsyslog.8,v 1.35 2007/12/21 05:40:59 dogcow Exp $
3 .\" Copyright (c) 1999, 2000 Andrew Doran <ad@NetBSD.org>
4 .\" All rights reserved.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\" notice, this list of conditions and the following disclaimer.
11 .\" 2. The name of the author may not be used to endorse or promote products
12 .\" derived from this software without specific prior written permission
14 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17 .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 .\" This file contains changes from the Open Software Foundation.
27 .\" Copyright 1988, 1989 by the Massachusetts Institute of Technology
29 .\" Permission to use, copy, modify, and distribute this software
30 .\" and its documentation for any purpose and without fee is
31 .\" hereby granted, provided that the above copyright notice
32 .\" appear in all copies and that both that copyright notice and
33 .\" this permission notice appear in supporting documentation,
34 .\" and that the names of M.I.T. and the M.I.T. S.I.P.B. not be
35 .\" used in advertising or publicity pertaining to distribution
36 .\" of the software without specific, written prior permission.
37 .\" M.I.T. and the M.I.T. S.I.P.B. make no representations about
38 .\" the suitability of this software for any purpose. It is
39 .\" provided "as is" without express or implied warranty.
41 .\" from FreeBSD: newsyslog.8,v 1.14.2.1 1999/02/25 18:38:33 wollman Exp
48 .Nd maintain system log files to manageable sizes
52 .Op Fl f Ar config_file
56 is a program that should be scheduled to run periodically by
58 When it is executed it archives log files if necessary.
59 If a log file is determined to require archiving,
61 rearranges the files so that
64 .Dq Va logfile Ns Li \&.0
66 the last period's logs in it,
67 .Dq Va logfile Ns Li \&.1
69 period's logs in it and so on, up to a user-specified number of
71 Optionally the archived logs can be compressed to save
74 A log can be archived for three reasons:
75 .Bl -enum -offset indent
77 It is larger than the configured size (in kilobytes).
79 A configured number of hours have elapsed since the log was last
82 The configured time for rotation of the log occurred within the last 60
88 is dependent on how often it is scheduled to run by
90 It is recommended that
96 reads in a configuration file to determine which logs may potentially
98 By default, this configuration file is
99 .Pa /etc/newsyslog.conf .
100 Each line of the file contains information about a particular log file
101 that should be handled by
103 Each line has six mandatory fields and three optional fields, with
104 whitespace separating each field.
105 Blank lines or lines beginning with
108 The fields of the configuration file are as
111 .Bl -tag -width indent
113 Name of the system log file to be archived.
115 This optional field specifies the owner and group for the archive file.
118 is essential, even if the
123 The field may be numeric, or a name which is present in
127 For backward compatibility,
131 however use of this feature is discouraged.
133 Specify the mode of the log file and archives.
135 Specify the number of archive files to be kept
136 besides the log file itself.
138 When the size of the log file reaches
140 kilobytes, the log file will be trimmed as described above.
141 If this field is replaced by an asterisk
143 then the size of the log file is not taken into account
144 when determining when to trim the log file.
148 field can consist of an interval, a specific time, or both.
153 log rotation will depend only on the contents of the
158 field consists of an optional interval in hours, optionally followed
160 .So Li \&@ Sc Ns No -sign
161 and a time in a restricted
164 .So Li \&$ Sc Ns No -sign
165 and a time specification for logfile rotation at a fixed time once
166 per day, per week or per month.
168 If a time is specified, the log file will only be trimmed if
170 is run within one hour of the specified time.
172 interval is specified, the log file will be trimmed if that many hours have
173 passed since the last rotation.
174 When both a time and an interval are
175 specified, the log will be trimmed if either condition is met.
177 There is no provision for specification of a timezone.
179 little point in specifying an explicit minutes or seconds component in
180 the current implementation, since the only comparison is `within the
183 .Em ISO 8601 restricted time format
185 The lead-in character for a restricted
189 .So Li \&@ Sc Ns No -sign .
190 The particular format of the time in restricted
221 Optional date fields default to the appropriate component of the
222 current date; optional time fields default to midnight; hence if today
223 is January 22, 1999, the following date specifications are all
226 .Bl -item -compact -offset indent
228 .Sq Li 19990122T000000
249 .Em Day, week and month time format
251 The lead-in character for day, week and month specification is a
252 .So Li \&$ Sc Ns No -sign .
253 The particular format of day, week and month specification is:
275 Optional time fields default to midnight.
276 The ranges for day and hour specifications are:
278 .Bl -tag -width Ds -compact -offset indent
280 hours, range 0 ... 23
282 day of week, range 0 ... 6, 0 = Sunday
284 day of month, range 1 ... 31, or the letter
288 to specify the last day of the month.
293 .Bl -tag -width Ds -compact -offset indent
295 rotate every night at midnight
297 rotate every day at 23:00 hr
299 rotate every week on Sunday at 23:00 hr
301 rotate every week on Friday at 16:00 hr
303 rotate at the last day of every month at midnight
305 rotate on every 5th day of month at 6:00 hr
309 This field specifies any special processing that is required.
310 These flags are parsed in a case insensitive manner.
312 flags and their meanings:
313 .Bl -tag -width indent
315 This flag means nothing - it is used as a spacer when no flags are set.
317 The file is a binary file or is not in
324 inserts to indicate that the logs have been trimmed should not be included.
326 Create an empty log file if none currently exists.
328 No signal should be sent when the log is trimmed.
330 The first historical log file (i.e. the historical log file with the suffix
332 should not be compressed.
334 Archived log files should be compressed with
338 Archived log files should be compressed with
342 .It Ar path_to_pid_file
343 This optional field specifies
344 the file name to read to find the daemon process id.
345 If this field is missing, it defaults to the
346 .Pa /var/run/syslogd.pid
350 is sent to the process id contained in this
353 This field must start with
355 in order to be recognized properly.
357 This optional field specifies the type of signal to be sent to the daemon
359 This may be a numeric or symbolic value.
360 By default a SIGHUP (hang-up) will be sent.
363 The following options can be used with newsyslog:
364 .Bl -tag -width indent
365 .It Fl f Ar config_file
369 .Pa /etc/newsyslog.conf
370 as the configuration file.
372 Do not trim the logs, but print out what would be done if this option were not
378 Remove the restriction that
380 must be running as root.
381 When running as a regular user,
383 will not be able to send a HUP signal to
385 so this option should be used only when debugging or trimming user generated
388 Do not signal daemon processes.
391 In this mode each action that is taken will be printed.
393 Force trimming of the logs, even if the trim conditions have not been met.
394 This option is useful for diagnosing system problems by providing you with
398 If additional command line arguments are given,
400 will only examine log files that match those arguments; otherwise, it
401 will examine all files listed in the configuration file.
403 .Bl -tag -width /etc/newsyslog.confxxxx -compact
404 .It Pa /etc/newsyslog.conf