=head1 NAME savelogs - save/rotate/delete log files nicely =head1 SYNOPSIS B saves your log files in a nice way (by default). savelogs --postmovehook='/usr/local/bin/restart_apache' \ --apacheconf=/www/conf/httpd.conf /var/log/messages savelogs `cat list_of_logs_to_process.txt` savelogs --loglevel=2 /var/log/maillog /var/log/cronlog \ /var/log/messages savelogs --config=/etc/savelogs.conf savelogs --period=15 /var/log/messages =head1 DESCRIPTION B is a flexible and robust log file archival system. Its logic is simple: move (rename) the log file, filter data from the log file, store the log file in an archive (via tar or gtar), and compress the archive (via gzip or compress). After successful compression, the original log file is deleted. All of the above phases are optional. This means that you may simply delete files if you wish. Or you may simply compress existing log files. Or you may move files and add them to a tar file but leave the tar file uncompressed, etc. You pick ;o) (If you just want to cut to the chase and don't care how B works, see the L section near the bottom of this document.) =head2 Savelogs Phases The processing order may be abbreviated into these five phases: move -> filter -> archive -> compress -> delete any of which may be subtracted from the process order. In addition to these phases are some intermediate 'hooks' where you may supply an external program or shell command to invoke. This is useful if you're rotating web server log files and you need to HUP (restart) your web server after moving the logs (for example). Subtracting phases is done in one of two possible ways. The first way is to specify it in the configuration file: Process move,archive,delete which will move log files and archive them (but not filter or compress them). After successful archival, the original log files will be deleted. The second way is to specify it on the command-line: --process=compress,delete which will simply compress log files (but not move, filter, or archive them). In addition to the five phase processing options above, you may also employ the following abbreviations: =over 4 =item I<(no option specified)> If you specify no B option, the default is I. =item I Do none of the phases. This isn't a very useful option. =item I Do all of the phases. =back =head2 An Overview A typical B session might begin by typing this command: savelogs --process=all /var/log/messages After which the following phases will execute: =over 4 =item I /var/log/messages --> /var/log/messages.010523 =item I (no filter supplied, so skip this phase) =item I add messages.010523 to /var/log/messages.tar =item I /var/log/messages.tar --> /var/log/messages.tar.gz =item I (/var/log/messages.010523 is deleted) =back 4 =head2 A Word About Paths All paths you specify to B should be relative to your home directory. You do not need to use a tilde (~). You may assume that B runs from your home directory and knows how to handle absolute paths. If my real home directory were located in F and I wanted to rotate the log file located in F, I would do something like this: savelogs /var/log/messages and B would Do What I Mean. The only exception to this are external commands given to B, B and other such options. Paths you specify here really are full paths. =head1 CONFIGURATION =head2 Configuration file option format B will read its configuration options from a configuration file (which you must supply) or from the command-line. Creating a configuration file is easy: it is a simple Apache-style plaintext file that has options specified in this format: Option value where I