最後更新: 2015-03-04
介紹
Postifx log 的 analysis 工具
You could then run this as a cronjob like so
Homepage: http://jimsun.linxnet.com/postfix_contrib.html
Download: http://jimsun.linxnet.com/downloads/pflogsumm-1.1.3.tar.gz
Centos Install pflogsumm
yum install
yum install postfix-perl-scripts
內有:
- /usr/sbin/pflogsumm
- /usr/sbin/qshape
人手安裝
requires module
- perl-Bit-Vector
- perl-Carp-Clan
- perl-Date-Calc
wget http://jimsun.linxnet.com/downloads/pflogsumm-1.1.3.tar.gz
tar -zxf pflogsumm-1.1.3.tar.gz
cd pflogsumm-1.1.3
mv pflogsumm.pl /usr/sbin/pflogsumm
version:
pflogsumm -version
pflogsumm.pl 1.1.3
Usage
pflogsumm [opts] <file>
opts:
-d today # gen 多久的 records. Default 成個 log file
-d yesterday
-e # extended detail
-h <cnt> # top <cnt> to display in host/domain reports.
-u <cnt> # top <cnt> to display in user reports.
-i (--ignore_case)
Suppresses the printing of the following detailed ( 舊版 )
- --no_smtpd_warnings
- --no_bounce_detail
- --no_deferral_detail
- --no_reject_detail
- --no_no_msg_size (Messages with no size data)
新版:
- --bounce-detail=0
- --deferral-detail=0
- --reject-detail=0
- --smtpd-warning-detail=0
more detail
- --verbose_msg_detail (For the message deferral, bounce and reject summaries: display the full "reason")
i.e.
pflogsumm -u 10 -h 10 maillog > /root/report.txt
Sent report by cron jobs:
crontab -e
0 2 * * * /path/to/pflogsumm.pl -d today /var/log/maillog | mail -s "Mail Report" [email protected]
opts:
- -d today generate report for just today
Report Example
Total number of: Messages received, delivered, forwarded, deferred, bounced and rejected Bytes in messages received and delivered Sending and Recipient Hosts/Domains Senders and Recipients Optional SMTPD totals for number of connections, number of hosts/domains connecting, average connect time and total connect time Per-Day Traffic Summary (for multi-day logs) Per-Hour Traffic (daily average for multi-day logs) Optional Per-Hour and Per-Day SMTPD connection summaries Sorted in descending order: Recipient Hosts/Domains by message count, including: Number of messages sent to recipient host/domain Number of bytes in messages Number of defers Average delivery delay Maximum delivery delay Sending Hosts/Domains by message and byte count Optional Hosts/Domains SMTPD connection summary Senders by message count Recipients by message count Senders by message size Recipients by message size with an option to limit these reports to the top nn. A Semi-Detailed Summary of: Messages deferred Messages bounced Messages rejected Summaries of warnings, fatal errors, and panics ================================= Grand Totals ------------ messages 4671 received 20104 delivered 9 forwarded 1523 deferred (53609 deferrals) 6834 bounced 602 rejected (2%) 0 reject warnings 0 held 0 discarded (0%) 603m bytes received 1064m bytes delivered 975 senders 664 sending hosts/domains 13156 recipients 1157 recipient hosts/domains Per-Day Traffic Summary date received delivered deferred bounced rejected -------------------------------------------------------------------- Feb 22 2015 42 48 0 0 8 Feb 23 2015 588 2246 4338 858 34 ................ Mar 1 2015 99 476 1259 173 4 Per-Hour Traffic Daily Average time received delivered deferred bounced rejected -------------------------------------------------------------------- 0000-0100 24 121 265 44 1 0100-0200 30 135 341 54 1 ................ 2300-2400 29 111 297 38 2 Host/Domain Summary: Message Delivery sent cnt bytes defers avg dly max dly host/domain -------- ------- ------- ------- ------- ----------- 6580 949m 0 3.2 s 6.1 m z.z.z 5616 9485k 1359 6.0 m 3.0 h yahoo.com 2914 4898k 249 1.8 m 2.5 h hotmail.com Host/Domain Summary: Messages Received msg cnt bytes host/domain -------- ------- ----------- 2761 379313k z.z.z 316 2299k 1.1.1.1 Senders by message count ------------------------ 2546 [email protected] 319 from=<> Recipients by message count --------------------------- 2918 [email protected] 2894 [email protected] Senders by message size ----------------------- 110419k [email protected] Recipients by message size -------------------------- 395823k [email protected] ........................................ message deferral detail ----------------------- error (total: 12984) 7355 4.7.1 : (DNS:NR 2866 4.7.1 : (DYN:T1 1378 http://postmaster.comcast.net/smtp-error-codes.php#554 133 lost connection with mta7.am0.yahoodns.net[98.136.217.202] whi... 114 mtaig-aaj04.mx.aol.com ESMTP not accepting connections
另見
其他工具
SendmailAnalyzer
http://sourceforge.net/projects/sa-report/