2 安装 Date::Calc
#perl -MCPAN -e shell
cpan> install Date::Calc
2 安装pflogsumm
tar zxvf pflogsumm-1.1.2.tar.gz
cd pflogsumm-1.1.2
cp pflogsumm.pl /usr/local/bin/pflogsumm
chown bin:bin /usr/local/bin/pflogsumm
chmod 755 /usr/local/bin/pflogsumm
#perl -MCPAN -e shell
cpan> install Date::Calc
2 安装pflogsumm
tar zxvf pflogsumm-1.1.2.tar.gz
cd pflogsumm-1.1.2
cp pflogsumm.pl /usr/local/bin/pflogsumm
chown bin:bin /usr/local/bin/pflogsumm
chmod 755 /usr/local/bin/pflogsumm
cp pflogsumm.1 /usr/share/man/man1/pflogsumm.1
chown bin:bin /usr/share/man/man1/pflogsumm.1
chmod 644 /usr/share/man/man1/pflogsumm.1
chown bin:bin /usr/share/man/man1/pflogsumm.1
chmod 644 /usr/share/man/man1/pflogsumm.1
3 运行命令,查看日志
/usr/local/bin/pflogsumm /var/log/maillog >analysis.log
more analysis.log 查看分析结果/usr/local/bin/pflogsumm /var/log/maillog >analysis.log
[root@mail pflogsumm-1.1.2]# more analysis.log
Grand Totals
------------
messages
459 received
14 delivered
0 forwarded
5 deferred (5 deferrals)
256 bounced
0 rejected (0%)
0 reject warnings
449 held
0 discarded (0%)
8237 bytes received
23082 bytes delivered
4 senders
2 sending hosts/domains
4 recipients
3 recipient hosts/domains
Per-Day Traffic Summary
-----------------------
date received delivered deferred bounced rejected
--------------------------------------------------------------------
Dec 30 2009 13 9 0 8 3
Dec 31 2009 446 5 5 248 446
Per-Hour Traffic Daily Average
------------------------------
time received delivered deferred bounced rejected
--------------------------------------------------------------------
0000-0100 3 2 1 5 3
0100-0200 3 1 0 5 3
0200-0300 2 0 0 4 2
0300-0400 2 0 0 4 2
0400-0500 3 0 0 5 3
0500-0600 3 0 0 5 3
0600-0700 2 0 0 4 2
0700-0800 2 0 0 4 2
0800-0900 2 0 0 4 2
0900-1000 3 1 2 4 3
1000-1100 2 0 0 5 2
1100-1200 2 0 0 4 2
1200-1300 2 0 0 4 2
1300-1400 2 0 0 4 2
1400-1500 4 0 0 8 4
1500-1600 8 0 0 16 8
1600-1700 8 0 0 16 8
1700-1800 8 0 0 16 8
1800-1900 80 0 0 9 80
1900-2000 85 0 0 0 85
2000-2100 0 0 0 0 0
2100-2200 1 1 0 0 0
2200-2300 2 2 0 0 0
2300-2400 4 2 0 4 2
Host/Domain Summary: Message Delivery
--------------------------------------
sent cnt bytes defers avg dly max dly host/domain
-------- ------- ------- ------- ------- -----------
11 14977 0 1.6 m 17.5 m epane.cn
--More--(4%)
或者写个计划任务脚本,定时输出分析结果。
本文转自andylhz 51CTO博客,原文链接:http://blog.51cto.com/andylhz2009/273159,如需转载请自行联系原作者