||Dimke Logfiles Backup
This Perl script creates automated backups of your apache logfiles.
Once installed there's no need to care about it any more. Just ftp your
archives to your local machine whenever you like to analyze or view them.
|How it works:
When running Apache webserver on top of Unix or Linux every access from a web browser is logged
and written into a logfile.
These files usually reside in your home directory and, depending on how Apache is configured,
those files will be overwritten after a configurable time period.
We recommend to configure it to overwrite these files monthly, so you obtain all files
when running the above metioned script.
During startup the script first creates the filename for the backup file in the form of "log_0604"
what means "log_" and then month and year containing the rightmost two digits.
Then all logfiles are opened and copied (appended) to the archive, one after the other.
Due to apache saving its logfiles in the way that the current logfile is called "access_log"
and yesterday's logfile is "access_log.1", this means that we have to start with the highest number,
e.g. "access_log.30" and then decrease this index down to "access_log.1" and finally "access_log".
After this operation the archive is closed and the external command "gzip" will be applied to the
archive file via system command. So the archive's name is, e.g. "log_0604.gz", and the size
will be about 8..10% or the original size.
|How to use:
Unpack the zip file into any directory accessible under your account, but we recommend NOT
to use your cgi directory to prevent people from invoking the script manually, i.e.
to cause the script to damage existing archives.
Edit the script, i.e. set the system path to the location where your logfiles live and where
you want the archive files to be stored.
Then put an entry into your crontab which invokes the script on the first day of every month
and be sure the script is executable, i.e. chmod it to be at least 700.
The crontab should contain a line similar to this one:
1 0 1 * * /complete/path/to/script/backup.pl