Annotation of src/usr.bin/newsyslog/newsyslog.8, Revision 1.24
1.24 ! millert 1: .\" $OpenBSD: newsyslog.8,v 1.23 2002/09/13 01:12:55 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.20 aaron 59: .Op Fl mnrv
60: .Op Fl f Ar config_file
1.4 downsj 61: .Sh DESCRIPTION
1.13 aaron 62: .Nm
1.1 deraadt 63: is a program that should be scheduled to run periodically by
1.4 downsj 64: .Xr cron 8 .
1.18 aaron 65: When it is executed it archives log files if necessary.
66: If a log file is determined to require archiving,
1.13 aaron 67: .Nm
68: rearranges the files so that
69: .Pa logfile
70: is empty,
71: .Pa logfile.0
72: has
73: the last period's logs in it,
74: .Pa logfile.1
75: has the next to last
1.1 deraadt 76: period's logs in it, and so on, up to a user-specified number of
1.18 aaron 77: archived logs.
1.20 aaron 78: Optionally the archived logs can be compressed to save space.
1.4 downsj 79: .Pp
1.18 aaron 80: The options are as follows:
81: .Bl -tag -width Ds
1.20 aaron 82: .It Fl m
83: Monitoring mode; only entries marked with an
84: .Sq M
85: in flags are processed,
86: and notifications sent if any have changed.
87: Without this option, monitored entries are not processed.
1.18 aaron 88: .It Fl n
89: Do not trim the logs, but instead print out what would be done if this option
90: were not specified.
91: .It Fl r
92: Removes the restriction that
93: .Nm
94: must be running as root.
95: Of course,
96: .Nm
97: will not be able to send a
98: .Dv SIGHUP
99: signal to
100: .Xr syslogd 8 ,
101: so this option should only be used in debugging.
1.20 aaron 102: .It Fl v
103: Be verbose.
104: In this mode it will print out each log and its
105: reasons for either trimming that log or skipping it.
106: .It Fl f Ar config_file
107: Use
108: .Ar config_file
109: instead of
110: .Pa /etc/newsyslog.conf
111: for the configuration file.
1.18 aaron 112: .El
113: .Pp
114: A log can be archived because of two reasons.
115: The log file can have
1.1 deraadt 116: grown bigger than a preset size in kilobytes, or a preset number of
1.18 aaron 117: hours may have elapsed since the last log archive.
118: The granularity of
1.13 aaron 119: .Nm
1.4 downsj 120: is dependent on how often it is scheduled to run in
121: .Xr cron 8 .
122: Since the program is quite fast, it may be scheduled to run every hour
1.1 deraadt 123: without any ill effects.
1.4 downsj 124: .Pp
1.13 aaron 125: When starting up,
126: .Nm
1.1 deraadt 127: reads in a configuration file to determine which logs should be looked
1.18 aaron 128: at.
129: By default, this configuration file is
1.4 downsj 130: .Pa /etc/newsyslog.conf .
1.1 deraadt 131: Each line of the file contains information about a particular log file
132: that should be handled by
1.4 downsj 133: .Nm newsyslog .
134: Each line has five mandatory fields and up to three optional fields, with a
1.18 aaron 135: whitespace separating each field.
136: Blank lines or lines beginning with a hash mark
137: .Pq Ql #
138: are ignored.
139: The fields of the configuration file are as
1.13 aaron 140: follows:
1.4 downsj 141: .Bl -tag -width XXXXXXXXXXXXXXXX
142: .It logfile name
143: The full pathname of the system log file to be archived.
144: .It owner.group of archives (optional)
1.18 aaron 145: Specify an ownership and group for the archive file.
146: The
1.13 aaron 147: .Ql \&.
148: is essential, even if the
1.4 downsj 149: .Ar owner
1.1 deraadt 150: or
1.4 downsj 151: .Ar group
1.18 aaron 152: field is left blank.
153: The fields may be numeric, or a name which is looked up
1.4 downsj 154: in the system password and group databases.
155: .It mode of logfile & archives
156: Octal mode of created log files and archives.
157: .It number of archives
1.6 d 158: Specify the number of archives to be kept besides the log file itself.
1.4 downsj 159: .It size of archives
1.24 ! millert 160: When the size of the log file (in kilobytes) reaches this point, the log
! 161: file is trimmed as described above.
1.18 aaron 162: If this field is replaced by a
1.13 aaron 163: .Ql * ,
164: then the size of
1.4 downsj 165: the log file is not taken into account when determining when to trim the
166: log file.
1.24 ! millert 167: By default, files smaller than 512 bytes are not rotated unless the
! 168: .Sq B
! 169: (binary) flag is set.
! 170: This prevents
! 171: .Nm
! 172: from rotating files consisting solely of a message indicating
! 173: that the log file has been turned over.
1.4 downsj 174: .It archive interval
1.18 aaron 175: Specify the time separation between the trimming of the log file.
176: If this field is replaced by a
1.13 aaron 177: .Ql * ,
178: the number of hours since the last time the
1.4 downsj 179: log was trimmed will not be taken into consideration.
180: .It flags (optional)
1.1 deraadt 181: The
1.4 downsj 182: .Ar flags
1.1 deraadt 183: field specifies if the archives should have any special processing
1.18 aaron 184: done to the archived log files.
185: The
1.13 aaron 186: .Sq Z
187: flag will make the archive
1.4 downsj 188: files compressed to save space using
189: .Xr gzip 1
190: or
191: .Xr compress 1 ,
1.18 aaron 192: depending on compilation options.
193: The
1.13 aaron 194: .Sq B
195: flag means that the file is a
1.8 aaron 196: binary file, and so the ASCII message which
1.13 aaron 197: .Nm
1.1 deraadt 198: inserts to indicate the fact that the logs have been turned over
1.18 aaron 199: should not be included.
200: The
1.13 aaron 201: .Sq M
202: flag marks this entry as a monitored
1.4 downsj 203: log file.
1.22 wcobb 204: The
205: .Sq F
206: flag specifies that symbolic links should be followed.
1.4 downsj 207: .It monitor notification (optional)
208: Specify the account that should receive notification messages if this is
1.18 aaron 209: a monitored log file.
210: Notification messages are sent as email; the operator
1.13 aaron 211: deserves what they get if they mark the
1.5 downsj 212: .Xr sendmail 8
1.6 d 213: log file as monitored.
1.7 millert 214: .It pid file (optional)
1.14 aaron 215: Specify a file containing the PID of a process to send a
216: .Dv SIGHUP
217: signal to instead of
1.7 millert 218: .Pa /var/run/syslog.pid .
1.16 millert 219: .It signal (optional)
1.18 aaron 220: Specify the signal to send to the process instead of
221: .Dv SIGHUP .
222: Signal names
1.16 millert 223: must start with
224: .Dq SIG
1.18 aaron 225: and be the signal name, not the number, e.g.,
1.23 millert 226: .Dv SIGUSR1 .
1.16 millert 227: .It command (optional)
228: Specify a command to run instead of sending a signal to the process.
1.18 aaron 229: The command must be enclosed in double quotes
230: .Pq Ql \&" ) .
231: You cannot specify both a command and a PID file.
1.19 millert 232: .Em NOTE:
233: If you specify a command to be run,
234: .Nm
235: will not send a
236: .Dv SIGHUP to
237: .Xr syslogd 8 .
1.4 downsj 238: .El
239: .Sh FILES
240: .Bl -tag -width /etc/newsyslog.conf
241: .It Pa /etc/newsyslog.conf
1.11 aaron 242: default configuration file
1.4 downsj 243: .El
244: .Sh SEE ALSO
1.8 aaron 245: .Xr compress 1 ,
1.4 downsj 246: .Xr gzip 1 ,
247: .Xr syslog 3 ,
1.8 aaron 248: .Xr syslogd 8
1.21 mpech 249: .Sh AUTHORS
1.18 aaron 250: .Bd -unfilled
1.1 deraadt 251: Theodore Ts'o, MIT Project Athena
252: Copyright 1987, Massachusetts Institute of Technology
1.4 downsj 253: .Ed