Thanks knut
below is the final script which i called postgreylog , added a cron job to run before syslog has been cleared. Not all systems have mail logging in syslog so customise as required.
Changed where the file is saved a little , might be interesting to get something like this into the users control panel so they can check to see if real mail is being blocked (my wife had 5 email addresses today).
had to change it just a little but overall it does it's job. Thanks for helping
to run script past into your most used editor
and save , then chmod +x it.
run to test.
sample output
here
Code:
#!/bin/bash
#postgreylog v1
#This script outputs the blocked mail into a readable logfile for each domain
#Idea Chris Jones 2009
#script written by Knut on isp-control.net forums 2009
#script re-edited by Chris Jones 2009
# Folder gathers the list of domains
FOLDER="/var/mail/virtual/"
#log should be the file you want read by postgrey report
log="/var/log/syslog"
#output edit the output so non-readable on net or post into a protected folder
output="/var/www/virtual/"
#Main script
#I require the .:====== part to make it readable by me it also looks better
for domain in $(ls $FOLDER); do
if test -d /var/www/virtual/$domain/htdocs; then
echo "Report for Domain $domain"
cat $log | grep $domain |postgreyreport --nosingle_line --check_sender=mx,a --show_tries --separate_by_subnet=.:===================================From===================================TO=======================:.MailServer-Sending-Mail\ > $output$domain/postgrey.log
fi
done
Thanks
Chris Jones