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