1 .\" This file contains changes from the Open Software Foundation.
3 .\" from: @(#)newsyslog.8
5 .\" Copyright 1988, 1989 by the Massachusetts Institute of Technology
7 .\" Permission to use, copy, modify, and distribute this software
8 .\" and its documentation for any purpose and without fee is
9 .\" hereby granted, provided that the above copyright notice
10 .\" appear in all copies and that both that copyright notice and
11 .\" this permission notice appear in supporting documentation,
12 .\" and that the names of M.I.T. and the M.I.T. S.I.P.B. not be
13 .\" used in advertising or publicity pertaining to distribution
14 .\" of the software without specific, written prior permission.
15 .\" M.I.T. and the M.I.T. S.I.P.B. make no representations about
16 .\" the suitability of this software for any purpose. It is
17 .\" provided "as is" without express or implied warranty.
24 .Nd maintain system log files to manageable sizes
30 .Op Fl f Ar config_file
33 .Op Oo Fl R Ar tagname Oc Ar
37 utility should be scheduled to run periodically by
39 When it is executed it archives log files if necessary.
41 is determined to require archiving,
43 rearranges the files so that
46 .Dq Va logfile Ns Li \&.0
48 the last period's logs in it,
49 .Dq Va logfile Ns Li \&.1
51 period's logs in it, and so on, up to a user-specified number of
53 It is also possible to let archived log filenames be created using the
54 time the log file was archived instead of the sequential number using
58 Optionally the archived logs can be compressed to save
61 A log can be archived for three reasons:
62 .Bl -enum -offset indent
64 It is larger than the configured size (in kilobytes).
66 A configured number of hours have elapsed since the log was last
69 This is the specific configured hour for rotation of the log.
74 is dependent on how often it is scheduled to run by
76 Since the program is quite fast, it may be scheduled to run every hour
77 without any ill effects,
78 and mode three (above) assumes that this is so.
80 The following options can be used with
82 .Bl -tag -width indent
83 .It Fl f Ar config_file
89 .Pa /etc/newsyslog.conf
90 for its configuration file.
94 into which archived log files will be written.
95 If a relative path is given,
96 it is appended to the path of each log file
97 and the resulting path is used as the directory
98 into which the archived log for that log file will be written.
99 If an absolute path is given,
100 all archived logs are written into the given
102 If any component of the path
105 it will be created when
108 .It Fl d Ar directory
111 which all log files will be relative to.
112 To allow archiving of logs outside the root, the
116 option is unaffected.
121 In this mode it will print out each log and its
122 reasons for either trimming that log or skipping it.
126 not to trim the logs, but to print out what it would do if this option
128 This option implies the
132 Remove the restriction that
134 must be running as root.
137 will not be able to send a HUP signal to
139 so this option should only be used in debugging.
143 should not send any signals to any daemon processes that it would
144 normally signal when rotating a log file.
145 For any log file which is rotated, this option will usually also
146 mean the rotated log file will not be compressed if there is a
147 daemon which would have been signalled without this option.
148 However, this option is most likely to be useful when specified
151 option, and in that case the compression will be done.
157 logfiles using the specified time format instead of the default
158 sequential filenames.
159 The filename used will be kept until it is deleted.
160 The time format is described in the
165 argument is set to an empty string or the string
167 the default built in time format
171 string is changed the old files created using the previous time format
172 will not be automatically removed (unless the new format is very
173 similar to the old format).
174 This is also the case when changing from sequential filenames to time
175 based file names, and the other way around.
176 The time format should contain at least year, month, day, and hour to
177 make sure rotating of old logfiles can select the correct logfiles.
179 If specified once, then
181 will create any log files which do not exist, and which have the
183 flag specified in their config file entry.
184 If specified multiple times, then
186 will create all log files which do not already exist.
187 If log files are given on the command-line, then the
191 will only apply to those specific log files.
195 to trim the logs, even if the trim conditions have not been met.
197 option is useful for diagnosing system problems by providing you with
198 fresh logs that contain only the problems.
200 Do not perform any rotations.
201 This option is intended to be used with the
205 options when creating log files is the only objective.
207 Prevent further action if we should send signal but the
209 is empty or does not exist.
213 should rotate a given list of files, even if trim conditions are not
217 is only used in the messages written to the log files which are
219 This differs from the
221 option in that one or more log files must also be specified, so that
223 will only operate on those specific files.
224 This option is mainly intended for the daemons or programs which write
225 some log files, and want to trigger a rotate based on their own criteria.
226 With this option they can execute
228 to trigger the rotate when they want it to happen, and still give the
229 system administrator a way to specify the rules of rotation (such as how
230 many backup copies are kept, and what kind of compression is done).
231 When a daemon does execute
235 option, it should make sure all of the log files are closed before
238 and then it should re-open the files after
241 Usually the calling process will also want to specify the
245 will not send a signal to the very process which called it to force
247 Skipping the signal step will also mean that
249 will return faster, since
251 normally waits a few seconds after any signal that is sent.
260 If additional command line arguments are given,
262 will only examine log files that match those arguments; otherwise, it
263 will examine all files listed in the configuration file.
265 .Bl -tag -width /usr/local/etc/newsyslog.conf.d -compact
266 .It Pa /etc/newsyslog.conf
269 .It Pa /etc/newsyslog.conf.d
270 By default each file in this directory ending in '.conf' and not beginning with
271 a '.' will be included by the default
273 .It Pa /usr/local/etc/newsyslog.conf.d
274 By default each file in this directory ending in '.conf' and not beginning with
275 a '.' will be included by the default
279 Previous versions of the
281 utility used the dot (``.'') character to
282 distinguish the group name.
285 this has been changed to a colon (``:'') character so that user and group
286 names may contain the dot character.
287 The dot (``.'') character is still
288 accepted for backwards compatibility.
295 .Xr newsyslog.conf 5 ,
301 utility originated from
303 and first appeared in
309 Copyright 1987, Massachusetts Institute of Technology