NAME
wclogrot - Rotate Log Files
SYNOPSIS
wclogrot [options] /path/to/file
DESCRIPTION
wclogrot was designed for use on the Wood County FreeNet, <http://www.wcnet.org/>.
wclogrot is a utility to make the rotation and management of log files easier. It was designed to be called from a cron job or some other regularly scheduled process.
On many Unix systems, log files such as /var/log/messages
will accumulate until they are manually cleaned or rotated. A common practice in rotating log files is to rename the current file from messages
to messages.0
, and if messages.0
already exists, it is renamed as messages.1
and so on.
wclogrot makes this process easier. One may simply invoke wclogrot with some command-line options (see ``OPTIONS'' below) to customize its behavior and the path to the log file which needs to be rotated. wclogrot takes care of keeping the right number of old log files on hand. It is able to send e-mail in the event of success and failure (if so desired). It can also compress the logs to conserve space using ``gzip''.
OPTIONS
wclogrot can take a combination of many command-line options. All options begin with a double-dash (--). Some take mandatory parameters, while others are simple flags to enable a certain option.
The available options are:
--mailto ``address''
Send mail upon success or failure to the listed address. If rotation
succeeds, the mail will contain a report of the old and new filename
as well as the number of old log files that were removed (see the
`keep' parameter). By default, all e-mail will go to root@localhost.
Enable the sending of mail to the address listed in
`mailto'. Mailing is disabled by default.
--debug
Enable the output of debugging messages to STDOUT. This is really
only useful for development or if you are trying to track down a
problem. The debugging messages should give you a good idea of what
is happening as wclogrot goes through its motions. Debugging is
disabled by default.
--compress
Enable compression of the rotated log files. Currently, the only
supported compression program is GNU Zip (gzip). Compressed files
will end in a .gz suffix. Compression is disabled by default.
--help
Display a brief help message to remind you of command-line
arguments. This won't happen by default.
--keep <number>
Tell wclogrot how many ``old'' log files you'd like to keep. This
does not count the new log that will be created after rotation. If
you specify ``--keep 3'' for rotating /var/log/messages, you will
eventually end up with messages.0, messages.1, and
messages.2. During each rotation, log files older that specified
will be removed. File ``age'' is determined by the suffix, not the
actual timestamp. The default value for keep is 1.
--zipcmd "/path/to/zip/program -and_options"
Specify and alternate program to be used for compression. This is
reserved for future use and shouldn't be used in the current
version, as it is somewhat hard-wired for ``gzip -9''. This
restriction will vanish in a future version.
BUGS
There are no known bugs yet.
wclogrot makes fairly extensive attempts to trap most trappable errors. In the event of a problem, it will send a failure notice via e-mail (if enabled) and exit with a non-zero exit code.
AUTHOR AND COPYRIGHT
Copyright 1998, Jeremy D. Zawodny <jzawodn@wcnet.org>
wclogrot may be used, copied, and re-distributed under the same terms as Perl.
VERSION
$Revision: 1.3 $