SquidGuard is a URL redirector used to use blacklists with the proxysoftware Squid. There are two big advantages to squidguard: it is fast and it is free.
Convert-Multilog
Primary tabs
Convert-Multilog
In order to get some nicer logs from our daemontool services, we'll use some of John Simpson's convert-multilog script to automatically clean them up and put daily log files into "/var/log".
I have written a program called convert-multilog which finds the log files created by multilog, converts their timestamps to a human-readable format, and adds them to log files in "/var/log" whose filenames are the service plus the date (i.e. all "/service/qmail-send/log/main/@*" files are combined into /var/log/qmail-send.YYYY-MM-DD.)
Install Perl module:
yum install perl-Sys-Syslog
Download and install the script:
cd /usr/local/sbin
wget http://qmail.jms1.net/scripts/convert-multilog
chmod 755 convert-multilog
Along with the required Logit.pm
, also written by John Simpson:
cd /usr/local/lib
wget http://www.jms1.net/code/Logit.pm
chmod 644 Logit.pm
Create a cron job to periodically run convert-multilog
:
- Add a file to
/etc/cron.d
which will periodically convert the log files:cd /etc/cron.d
echo '7 * * * * root /usr/local/sbin/convert-multilog >/dev/null 2>&1' > multilog
chmod 644 multilog
touch /etc/crontab - or, on systems that don't have a
/etc/cron.d
directory (such as *BSD), edit crontab (crontab -e
) and create an entry:
7 * * * * root /usr/local/sbin/convert-multilog
Archiving the Log Files
John's script does a great job of making the logs more readable. However, the log files tend to accumulate. While you could just delete your old log files, in case you want or need to archive them here is an archiving script which can be run at the beginning of a new month to collect and compress the previous month's log files:
cd /usr/local/bin
wget http://www.productionmonkeys.net/sites/productionmonkeys.net/files/monthlyLogArchive.pl.txt
mv monthlyLogArchive.pl.txt monthlyLogArchive.pl
chmod ugo+x monthlyLogArchive.pl
Create a cron entry to archive each month:
cd /etc/cron.d
echo '0 0 1 * * root /usr/local/bin/monthlyLogArchive.pl' > monthlyLogArchive
chmod 644 monthlyLogArchive
touch /etc/crontab
Purging old log files
John Simpson wrote a delbut script for deleting "all but" the latest versions of a file.
- Log in to post comments
Credits
Various bits of code, scripts, and procedures were put together with information from John Simpson's qmail.jms1.net website. It's an excellent resource on managing and setting up a Qmail server.