version 1.12, 1999/05/23 14:11:30 |
version 1.13, 1999/06/05 01:21:35 |
|
|
.\" from: @(#)newsyslog.8 |
.\" from: @(#)newsyslog.8 |
.\" |
.\" |
.\" Copyright 1988, 1989 by the Massachusetts Institute of Technology |
.\" Copyright 1988, 1989 by the Massachusetts Institute of Technology |
.\" |
.\" |
.\" Permission to use, copy, modify, and distribute this software |
.\" Permission to use, copy, modify, and distribute this software |
.\" and its documentation for any purpose and without fee is |
.\" and its documentation for any purpose and without fee is |
.\" hereby granted, provided that the above copyright notice |
.\" hereby granted, provided that the above copyright notice |
|
|
.Op Fl vmnr |
.Op Fl vmnr |
.Op Fl f Ar configuration file |
.Op Fl f Ar configuration file |
.Sh DESCRIPTION |
.Sh DESCRIPTION |
.Nm newsyslog |
.Nm |
is a program that should be scheduled to run periodically by |
is a program that should be scheduled to run periodically by |
.Xr cron 8 . |
.Xr cron 8 . |
When it is executed it archives log files if necessary. If a log file |
When it is executed it archives log files if necessary. If a log file |
is determined to require archiving, |
is determined to require archiving, |
.Nm newsyslog |
.Nm |
rearranges the files so that ``logfile'' is empty, ``logfile.0'' has |
rearranges the files so that |
the last period's logs in it, ``logfile.1'' has the next to last |
.Pa logfile |
|
is empty, |
|
.Pa logfile.0 |
|
has |
|
the last period's logs in it, |
|
.Pa logfile.1 |
|
has the next to last |
period's logs in it, and so on, up to a user-specified number of |
period's logs in it, and so on, up to a user-specified number of |
archived logs. Optionally the archived logs can be compressed to save |
archived logs. Optionally the archived logs can be compressed to save |
space. |
space. |
.Pp |
.Pp |
A log can be archived because of two reasons. The log file can have |
A log can be archived because of two reasons. The log file can have |
grown bigger than a preset size in kilobytes, or a preset number of |
grown bigger than a preset size in kilobytes, or a preset number of |
hours may have elapsed since the last log archive. The granularity of |
hours may have elapsed since the last log archive. The granularity of |
.Nm newsyslog |
.Nm |
is dependent on how often it is scheduled to run in |
is dependent on how often it is scheduled to run in |
.Xr cron 8 . |
.Xr cron 8 . |
Since the program is quite fast, it may be scheduled to run every hour |
Since the program is quite fast, it may be scheduled to run every hour |
without any ill effects. |
without any ill effects. |
.Pp |
.Pp |
When starting up, |
When starting up, |
.Nm newsyslog |
.Nm |
reads in a configuration file to determine which logs should be looked |
reads in a configuration file to determine which logs should be looked |
at. By default, this configuration file is |
at. By default, this configuration file is |
.Pa /etc/newsyslog.conf . |
.Pa /etc/newsyslog.conf . |
Each line of the file contains information about a particular log file |
Each line of the file contains information about a particular log file |
that should be handled by |
that should be handled by |
.Nm newsyslog . |
.Nm newsyslog . |
Each line has five mandatory fields and up to three optional fields, with a |
Each line has five mandatory fields and up to three optional fields, with a |
whitespace separating each field. Blank lines or lines beginning with |
whitespace separating each field. Blank lines or lines beginning with |
``#'' are ignored. The fields of the configuration file are as |
.Ql # |
follows: |
are ignored. The fields of the configuration file are as |
|
follows: |
.Bl -tag -width XXXXXXXXXXXXXXXX |
.Bl -tag -width XXXXXXXXXXXXXXXX |
.It logfile name |
.It logfile name |
The full pathname of the system log file to be archived. |
The full pathname of the system log file to be archived. |
.It owner.group of archives (optional) |
.It owner.group of archives (optional) |
Specify an ownership and group for the archive file. The "." is essential, |
Specify an ownership and group for the archive file. The |
even if the |
.Ql \&. |
|
is essential, even if the |
.Ar owner |
.Ar owner |
or |
or |
.Ar group |
.Ar group |
|
|
Specify the number of archives to be kept besides the log file itself. |
Specify the number of archives to be kept besides the log file itself. |
.It size of archives |
.It size of archives |
When the size of the log file reaches this point, the log file becomes trimmed |
When the size of the log file reaches this point, the log file becomes trimmed |
as described above. If this field is replaced by a ``*'', then the size of |
as described above. If this field is replaced by a |
|
.Ql * , |
|
then the size of |
the log file is not taken into account when determining when to trim the |
the log file is not taken into account when determining when to trim the |
log file. |
log file. |
.It archive interval |
.It archive interval |
Specify the time separation between the trimming of the log file. If this |
Specify the time separation between the trimming of the log file. If this |
field is replaced by a ``*'', the number of hours since the last time the |
field is replaced by a |
|
.Ql * , |
|
the number of hours since the last time the |
log was trimmed will not be taken into consideration. |
log was trimmed will not be taken into consideration. |
.It flags (optional) |
.It flags (optional) |
The |
The |
.Ar flags |
.Ar flags |
field specifies if the archives should have any special processing |
field specifies if the archives should have any special processing |
done to the archived log files. The ``Z'' flag will make the archive |
done to the archived log files. The |
|
.Sq Z |
|
flag will make the archive |
files compressed to save space using |
files compressed to save space using |
.Xr gzip 1 |
.Xr gzip 1 |
or |
or |
.Xr compress 1 , |
.Xr compress 1 , |
depending on compilation options. The ``B'' flag means that the file is a |
depending on compilation options. The |
|
.Sq B |
|
flag means that the file is a |
binary file, and so the ASCII message which |
binary file, and so the ASCII message which |
.Nm newsyslog |
.Nm |
inserts to indicate the fact that the logs have been turned over |
inserts to indicate the fact that the logs have been turned over |
should not be included. The ``M'' flag marks this entry as a monitored |
should not be included. The |
|
.Sq M |
|
flag marks this entry as a monitored |
log file. |
log file. |
.It monitor notification (optional) |
.It monitor notification (optional) |
Specify the account that should receive notification messages if this is |
Specify the account that should receive notification messages if this is |
a monitored log file. Notification messages are sent as email; the operator |
a monitored log file. Notification messages are sent as email; the operator |
deserves what they get if they mark the |
deserves what they get if they mark the |
.Xr sendmail 8 |
.Xr sendmail 8 |
log file as monitored. |
log file as monitored. |
.It pid file (optional) |
.It pid file (optional) |
|
|
.Nm newsyslog : |
.Nm newsyslog : |
.Bl -tag -width XXX |
.Bl -tag -width XXX |
.It Fl f Ar config-file |
.It Fl f Ar config-file |
Instructs newsyslog to use |
Instructs newsyslog to use |
.Ar config-file |
.Ar config-file |
instead of |
instead of |
.Pa /etc/newsyslog.conf |
.Pa /etc/newsyslog.conf |
for its configuration file. |
for its configuration file. |
.It Fl v |
.It Fl v |
Places |
Places |
.Nm newsyslog |
.Nm |
in verbose mode. In this mode it will print out each log and its |
in verbose mode. In this mode it will print out each log and its |
reasons for either trimming that log or skipping it. |
reasons for either trimming that log or skipping it. |
.It Fl n |
.It Fl n |
Causes |
Causes |
.Nm newsyslog |
.Nm |
not to trim the logs, but to print out what it would do if this option |
not to trim the logs, but to print out what it would do if this option |
were not specified. |
were not specified. |
.It Fl r |
.It Fl r |
Removes the restriction that |
Removes the restriction that |
.Nm newsyslog |
.Nm |
must be running as root. Of course, |
must be running as root. Of course, |
.Nm newsyslog |
.Nm |
will not be able to send a HUP signal to |
will not be able to send a HUP signal to |
.Xr syslogd 8 , |
.Xr syslogd 8 , |
so this option should only be used in debugging. |
so this option should only be used in debugging. |
.It Fl m |
.It Fl m |
Places |
Places |
.Nm newsyslog |
.Nm |
in monitoring mode; only entries marked with an ``M'' in flags are processed, |
in monitoring mode; only entries marked with an |
|
.Sq M |
|
in flags are processed, |
and notifications sent if any have changed. Without this option, monitored |
and notifications sent if any have changed. Without this option, monitored |
entries are not processed. |
entries are not processed. |
.El |
.El |