xref: /freebsd/usr.sbin/newsyslog/newsyslog.8 (revision b5b2a90624d3d900a42e99758eb95293d04f37fa)
1.\" This file contains changes from the Open Software Foundation.
2.\"
3.\"	from: @(#)newsyslog.8
4.\"	$Id: newsyslog.8,v 1.4 1997/02/22 16:08:25 peter Exp $
5.\"
6.\" Copyright 1988, 1989 by the Massachusetts Institute of Technology
7.\"
8.\" Permission to use, copy, modify, and distribute this software
9.\" and its documentation for any purpose and without fee is
10.\" hereby granted, provided that the above copyright notice
11.\" appear in all copies and that both that copyright notice and
12.\" this permission notice appear in supporting documentation,
13.\" and that the names of M.I.T. and the M.I.T. S.I.P.B. not be
14.\" used in advertising or publicity pertaining to distribution
15.\" of the software without specific, written prior permission.
16.\" M.I.T. and the M.I.T. S.I.P.B. make no representations about
17.\" the suitability of this software for any purpose.  It is
18.\" provided "as is" without express or implied warranty.
19.\"
20.Dd "January 12, 1989"
21.Dt NEWSYSLOG 8
22.Os
23.Sh NAME
24.Nm newsyslog
25.Nd maintain system log files to manageable sizes
26.Sh SYNOPSIS
27.Nm newsyslog
28.Op Fl rnv
29.Op Fl f Ar config_file
30.Sh DESCRIPTION
31.Nm Newsyslog
32is a program that should be scheduled to run periodically by
33.Xr cron 8 .
34When it is executed it archives log files if necessary.  If a log file
35is determined to require archiving,
36.Nm newsyslog
37rearranges the files so that ``logfile'' is empty, ``logfile.0'' has
38the last period's logs in it, ``logfile.1'' has the next to last
39period's logs in it, and so on, up to a user-specified number of
40archived logs.  Optionally the archived logs can be compressed to save
41space.
42.Pp
43A log can be archived because of two reasons.  The log file can have
44grown bigger than a preset size in kilobytes, or a preset number of
45hours may have elapsed since the last log archive.  The granularity of
46.Nm newsyslog
47is dependent on how often it is scheduled to run by
48.Xr cron 8 .
49Since the program is quite fast, it may be scheduled to run every hour
50without any ill effects.
51.Pp
52When starting up,
53.Nm newsyslog
54reads in a configuration file to determine which logs should be looked
55at.  By default, this configuration file is
56.Pa /etc/newsyslog.conf .
57Each line of the file contains information about a particular log file
58that should be handled by
59.Nm newsyslog .
60Each line has five mandatory fields and two optional fields, with a
61whitespace separating each field.  Blank lines or lines beginning with
62``#'' are ignored.  The fields of the configuration file are as
63follows:
64.Pp
65.Bl -tag -width logfile_namexxxx
66.It Ar logfile_name
67Name of the system log file to be archived.
68.It Ar owner.group
69Specifies the owner and group for the archive file.
70The "." is essential, even if the
71.Ar owner
72or
73.Ar group
74field is left blank.  The field may be numeric, or a name which is
75present in
76.Pa /etc/passwd
77or
78.Pa /etc/group.
79.It Ar mode
80Specifies the mode of the log file and archives.
81.It Ar count
82Specifies the number of archive files to be kept
83besides the log file itself.
84.It Ar size
85When the size of the log file reaches
86.Ar size ,
87the log file will be trimmed as described above.  If this field
88is replaced by a
89.Ar * ,
90then the size of the log file is not taken into account
91when determining when to trim the log file.
92of archives
93.It Ar interval
94When
95.Ar interval
96hours have passed, the log file will be trimmed.  If this field is
97replaced by a
98.Ar * ,
99then the number of hours since the last time the log was
100trimmed will not be taken into consideration.
101.It Ar flags
102This optional field specifies if the archive should have any
103special processing done to the archived log files.
104The
105.Ar Z
106flag will make the archive files compress to save space by
107using
108.Xr gzip 1 .
109The
110.Ar B
111flag means that the file is a binary file, and so the ASCII
112message which
113.Nm
114inserts to indicate the fact that the logs have been
115turned over should not be included.
116.El
117.Sh OPTIONS
118The following options can be used with newsyslog:
119.Bl -tag -width indent
120.It Fl f Ar config_file
121instructs newsyslog to use
122.Ar config_file
123instead of
124.Pa /etc/newsyslog.conf
125for its configuration file.
126.It Fl v
127places
128.Nm newsyslog
129in verbose mode.  In this mode it will print out each log and its
130reasons for either trimming that log or skipping it.
131.It Fl n
132causes
133.Nm newsyslog
134not to trim the logs, but to print out what it would do if this option
135were not specified.
136.It Fl r
137removes the restriction that
138.Nm newsyslog
139must be running as root.  Of course,
140.Nm newsyslog
141will not be able to send a HUP signal to
142.Xr syslogd 8
143so this option should only be used in debugging.
144.El
145.Sh FILES
146.Bl -tag -width /etc/newsyslog.confxxxx -comapct
147.It Pa /etc/newsyslog.conf
148.Nm newsyslog
149configuration file.
150.El
151.Sh BUGS
152Doesn't yet automatically read the logs to find security breaches.
153.Sh AUTHOR
154Theodore Ts'o, MIT Project Athena
155.Pp
156Copyright 1987, Massachusetts Institute of Technology
157.Sh "SEE ALSO"
158.Xr gzip 1 ,
159.Xr syslog 3 ,
160.Xr syslogd 8
161