postfix 日志分析

# statistic recipient
echo "Part one : - Top 10 Recipient domain "
fgrep to= /var/log/maillog | cut -d\< -f2 | cut -d\> -f1 | cut -d@ -f2 | sort | uniq -c | sort -nr |head

# statistic sender
echo "Part two: - Top 10 Sender domain "
fgrep from= /var/log/maillog | cut -d\< -f2 | cut -d\> -f1 | cut -d@ -f2 | sort | uniq -c | sort -nr | head

# statistic destination mail total count
echo "Part three: Total lines and sizes of log, And total mail sent"
cat /var/log/maillog | fgrep status=sent | wc -l | awk '{ print $1 }'

echo ""; echo "Scanning maillog for rejections:"
cat -fc /var/log/maillog | egrep reject: | cut -d : -f 5- | sort | uniq -c | sort -nr | grep -v '^  *[1-2]  *[^ ]* [^ ]* from [^ ]*: 450 '

echo "Scanning maillog for warnings:"
cat /var/log/maillog | egrep warning: | cut -d : -f 5- | sort | uniq -c

echo "Scanning maillog for trouble:"
cat /var/log/maillog | egrep '(fatal|panic):'

检查hash文件结果的命令
 postmap -q xxxxxx@163.com hash:permited_sender
 postmap -q "xxxxxx@163.com" mysql:/usr/local/etc/postfix/mysql-sender.cf

 

posted @ 2010-08-05 14:47  Ellison Pine  阅读(1072)  评论(0编辑  收藏  举报