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 [email protected] hash:permited_sender
 postmap -q "[email protected]" mysql:/usr/local/etc/postfix/mysql-sender.cf

转载于:https://www.cnblogs.com/lvsong/archive/2010/08/05/1793215.html

猜你喜欢

转载自blog.csdn.net/weixin_34249678/article/details/92959775