Annotation of src/usr.bin/newsyslog/newsyslog.8, Revision 1.28
1.28 ! millert 1: .\" $OpenBSD: newsyslog.8,v 1.27 2002/09/17 20:16:43 millert Exp $
1.4 downsj 2: .\"
3: .\" Copyright (c) 1997, Jason Downs. All rights reserved.
4: .\"
5: .\" Redistribution and use in source and binary forms, with or without
6: .\" modification, are permitted provided that the following conditions
7: .\" are met:
8: .\" 1. Redistributions of source code must retain the above copyright
9: .\" notice, this list of conditions and the following disclaimer.
10: .\" 2. Redistributions in binary form must reproduce the above copyright
11: .\" notice, this list of conditions and the following disclaimer in the
12: .\" documentation and/or other materials provided with the distribution.
13: .\" 3. All advertising materials mentioning features or use of this software
14: .\" must display the following acknowledgement:
15: .\" This product includes software developed by Jason Downs for the
16: .\" OpenBSD system.
17: .\" 4. Neither the name(s) of the author(s) nor the name OpenBSD
18: .\" may be used to endorse or promote products derived from this software
19: .\" without specific prior written permission.
20: .\"
21: .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS
22: .\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23: .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24: .\" DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT,
25: .\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26: .\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27: .\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28: .\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29: .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30: .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31: .\" SUCH DAMAGE.
32: .\"
1.1 deraadt 33: .\" This file contains changes from the Open Software Foundation.
34: .\"
35: .\" from: @(#)newsyslog.8
36: .\"
37: .\" Copyright 1988, 1989 by the Massachusetts Institute of Technology
1.13 aaron 38: .\"
1.1 deraadt 39: .\" Permission to use, copy, modify, and distribute this software
40: .\" and its documentation for any purpose and without fee is
41: .\" hereby granted, provided that the above copyright notice
42: .\" appear in all copies and that both that copyright notice and
43: .\" this permission notice appear in supporting documentation,
44: .\" and that the names of M.I.T. and the M.I.T. S.I.P.B. not be
45: .\" used in advertising or publicity pertaining to distribution
46: .\" of the software without specific, written prior permission.
47: .\" M.I.T. and the M.I.T. S.I.P.B. make no representations about
48: .\" the suitability of this software for any purpose. It is
49: .\" provided "as is" without express or implied warranty.
50: .\"
1.16 millert 51: .Dd November 11, 1999
1.4 downsj 52: .Dt NEWSYSLOG 8
1.12 aaron 53: .Os
1.4 downsj 54: .Sh NAME
55: .Nm newsyslog
56: .Nd maintain system log files to manageable sizes
57: .Sh SYNOPSIS
1.10 aaron 58: .Nm newsyslog
1.27 millert 59: .Op Fl Fmnrv
1.26 millert 60: .Op Fl a Ar directory
1.20 aaron 61: .Op Fl f Ar config_file
1.28 ! millert 62: .Op Ar log ...
1.4 downsj 63: .Sh DESCRIPTION
1.13 aaron 64: .Nm
1.1 deraadt 65: is a program that should be scheduled to run periodically by
1.4 downsj 66: .Xr cron 8 .
1.18 aaron 67: When it is executed it archives log files if necessary.
68: If a log file is determined to require archiving,
1.13 aaron 69: .Nm
70: rearranges the files so that
71: .Pa logfile
72: is empty,
73: .Pa logfile.0
74: has
75: the last period's logs in it,
76: .Pa logfile.1
77: has the next to last
1.1 deraadt 78: period's logs in it, and so on, up to a user-specified number of
1.18 aaron 79: archived logs.
1.20 aaron 80: Optionally the archived logs can be compressed to save space.
1.4 downsj 81: .Pp
1.18 aaron 82: The options are as follows:
83: .Bl -tag -width Ds
1.27 millert 84: .It Fl F
85: Force
86: .Nm
87: to trim logs regardless of the size and/or age requirements specified in
88: .Pa /etc/newsyslog.conf .
89: This option may be combined with the
90: .Fl n
91: or
92: .Fl v
93: flags to aid in debugging problems with
94: .Pa /etc/newsyslog.conf .
1.20 aaron 95: .It Fl m
96: Monitoring mode; only entries marked with an
97: .Sq M
98: in flags are processed,
99: and notifications sent if any have changed.
100: Without this option, monitored entries are not processed.
1.18 aaron 101: .It Fl n
102: Do not trim the logs, but instead print out what would be done if this option
103: were not specified.
104: .It Fl r
105: Removes the restriction that
106: .Nm
107: must be running as root.
108: Of course,
109: .Nm
110: will not be able to send a
111: .Dv SIGHUP
112: signal to
113: .Xr syslogd 8 ,
114: so this option should only be used in debugging.
1.20 aaron 115: .It Fl v
116: Be verbose.
117: In this mode it will print out each log and its
118: reasons for either trimming that log or skipping it.
1.26 millert 119: .It Fl a Ar directory
120: Specify a
121: .Ar directory
122: into which archived log files will be written.
123: If
124: .Ar directory
125: is a relative path, it is it is appended to the parent directory
126: of each log and the archived log is stored in the result.
127: If an absolute path is given, all archived logs are stored in the given
128: .Ar directory .
129: If
130: .Ar directory
131: does not exist for a specified log, it is ignored for that entry and
132: the log is rotated as if the
133: .Fl a
134: option was not specified.
1.20 aaron 135: .It Fl f Ar config_file
136: Use
137: .Ar config_file
138: instead of
139: .Pa /etc/newsyslog.conf
140: for the configuration file.
1.18 aaron 141: .El
1.28 ! millert 142: .Pp
! 143: If one or more
! 144: .Ar log
! 145: files are specified on the command line, only the specified logs will
! 146: be rotated.
! 147: Note that each
! 148: .Ar log
! 149: specified must have an entry in
! 150: .Pa /etc/newsyslog.conf .
1.18 aaron 151: .Pp
152: A log can be archived because of two reasons.
153: The log file can have
1.1 deraadt 154: grown bigger than a preset size in kilobytes, or a preset number of
1.18 aaron 155: hours may have elapsed since the last log archive.
156: The granularity of
1.13 aaron 157: .Nm
1.4 downsj 158: is dependent on how often it is scheduled to run in
159: .Xr cron 8 .
160: Since the program is quite fast, it may be scheduled to run every hour
1.1 deraadt 161: without any ill effects.
1.4 downsj 162: .Pp
1.13 aaron 163: When starting up,
164: .Nm
1.1 deraadt 165: reads in a configuration file to determine which logs should be looked
1.18 aaron 166: at.
167: By default, this configuration file is
1.4 downsj 168: .Pa /etc/newsyslog.conf .
1.1 deraadt 169: Each line of the file contains information about a particular log file
170: that should be handled by
1.4 downsj 171: .Nm newsyslog .
172: Each line has five mandatory fields and up to three optional fields, with a
1.18 aaron 173: whitespace separating each field.
174: Blank lines or lines beginning with a hash mark
175: .Pq Ql #
176: are ignored.
177: The fields of the configuration file are as
1.13 aaron 178: follows:
1.4 downsj 179: .Bl -tag -width XXXXXXXXXXXXXXXX
180: .It logfile name
181: The full pathname of the system log file to be archived.
182: .It owner.group of archives (optional)
1.18 aaron 183: Specify an ownership and group for the archive file.
184: The
1.13 aaron 185: .Ql \&.
186: is essential, even if the
1.4 downsj 187: .Ar owner
1.1 deraadt 188: or
1.4 downsj 189: .Ar group
1.18 aaron 190: field is left blank.
191: The fields may be numeric, or a name which is looked up
1.4 downsj 192: in the system password and group databases.
193: .It mode of logfile & archives
194: Octal mode of created log files and archives.
195: .It number of archives
1.6 d 196: Specify the number of archives to be kept besides the log file itself.
1.4 downsj 197: .It size of archives
1.24 millert 198: When the size of the log file (in kilobytes) reaches this point, the log
199: file is trimmed as described above.
1.18 aaron 200: If this field is replaced by a
1.13 aaron 201: .Ql * ,
202: then the size of
1.4 downsj 203: the log file is not taken into account when determining when to trim the
204: log file.
1.25 millert 205: By default, files smaller than 512 bytes are not rotated unless the
1.24 millert 206: .Sq B
207: (binary) flag is set.
208: This prevents
209: .Nm
210: from rotating files consisting solely of a message indicating
211: that the log file has been turned over.
1.4 downsj 212: .It archive interval
1.18 aaron 213: Specify the time separation between the trimming of the log file.
214: If this field is replaced by a
1.13 aaron 215: .Ql * ,
216: the number of hours since the last time the
1.4 downsj 217: log was trimmed will not be taken into consideration.
218: .It flags (optional)
1.1 deraadt 219: The
1.4 downsj 220: .Ar flags
1.1 deraadt 221: field specifies if the archives should have any special processing
1.18 aaron 222: done to the archived log files.
223: The
1.13 aaron 224: .Sq Z
225: flag will make the archive
1.4 downsj 226: files compressed to save space using
227: .Xr gzip 1
228: or
229: .Xr compress 1 ,
1.18 aaron 230: depending on compilation options.
231: The
1.13 aaron 232: .Sq B
233: flag means that the file is a
1.8 aaron 234: binary file, and so the ASCII message which
1.13 aaron 235: .Nm
1.1 deraadt 236: inserts to indicate the fact that the logs have been turned over
1.18 aaron 237: should not be included.
238: The
1.13 aaron 239: .Sq M
240: flag marks this entry as a monitored
1.4 downsj 241: log file.
1.22 wcobb 242: The
243: .Sq F
244: flag specifies that symbolic links should be followed.
1.4 downsj 245: .It monitor notification (optional)
246: Specify the account that should receive notification messages if this is
1.18 aaron 247: a monitored log file.
248: Notification messages are sent as email; the operator
1.13 aaron 249: deserves what they get if they mark the
1.5 downsj 250: .Xr sendmail 8
1.6 d 251: log file as monitored.
1.7 millert 252: .It pid file (optional)
1.14 aaron 253: Specify a file containing the PID of a process to send a
254: .Dv SIGHUP
255: signal to instead of
1.7 millert 256: .Pa /var/run/syslog.pid .
1.16 millert 257: .It signal (optional)
1.18 aaron 258: Specify the signal to send to the process instead of
259: .Dv SIGHUP .
260: Signal names
1.16 millert 261: must start with
262: .Dq SIG
1.18 aaron 263: and be the signal name, not the number, e.g.,
1.23 millert 264: .Dv SIGUSR1 .
1.16 millert 265: .It command (optional)
266: Specify a command to run instead of sending a signal to the process.
1.18 aaron 267: The command must be enclosed in double quotes
268: .Pq Ql \&" ) .
269: You cannot specify both a command and a PID file.
1.25 millert 270: .Em NOTE:
1.19 millert 271: If you specify a command to be run,
272: .Nm
273: will not send a
274: .Dv SIGHUP to
275: .Xr syslogd 8 .
1.4 downsj 276: .El
277: .Sh FILES
278: .Bl -tag -width /etc/newsyslog.conf
279: .It Pa /etc/newsyslog.conf
1.11 aaron 280: default configuration file
1.4 downsj 281: .El
282: .Sh SEE ALSO
1.8 aaron 283: .Xr compress 1 ,
1.4 downsj 284: .Xr gzip 1 ,
285: .Xr syslog 3 ,
1.8 aaron 286: .Xr syslogd 8
1.21 mpech 287: .Sh AUTHORS
1.18 aaron 288: .Bd -unfilled
1.1 deraadt 289: Theodore Ts'o, MIT Project Athena
290: Copyright 1987, Massachusetts Institute of Technology
1.4 downsj 291: .Ed