Automating Log Statistics
Posted by mike Filed Under Statistics with 2 Comments
This tutorial will show you how to set up your log statistics to be mailed to you every night so you know what is happening with your Postfix Mail Server.
Set up a cron job so that it will run at 11:55 PM, just before midnight as you want to get all of the logs for that day. Be sure to give enough time for the script to run before the next day. Here is the line to use if you have install pflogsumm at /usr/pflogsumm, see this article for installation.
As root run:
crontab -e
Now add this line with your email at the end. Note the \ which indicates a line break.
55 23 * * * /usr/pflogsumm/./pflogsumm.pl -u 5 -h 5 –problems_first -d today \
/var/log/maillog | mail -s “PostFix Report `date`” \someemail@somewhere.com
Here is an example
Postfix log summaries for Nov 13
Grand Totals
————
messages
19 received
16 delivered
0 forwarded
1 deferred (5 deferrals)
1 bounced
16 rejected (50%)
0 reject warnings
0 held
0 discarded (0%)
69610 bytes received
66259 bytes delivered
10 senders
9 sending hosts/domains
6 recipients
6 recipient hosts/domains
message deferral detail
———————–
smtp (total: 5)
3 hjeigb.info[69.64.157.16]: Connection refused
2 conversation with hjeigb.info[216.52.184.243] timed out while …
message bounce detail (by relay)
——————————–
none (total: 1)
1 Host not found
message reject detail
———————
cleanup
header (total: 2)
1 Content-Type: text/html; charset=”iso-2022-jp”
1 Content-Type: text/plain;??charset=”gb2312″
RCPT
blocked using sbl-xbl.spamhaus.org (total: 2)
1 125.187.32.174
1 konstantynow.mm.pl
Helo command rejected: need fully-qualified hostname (total: 8)
2 122.198.44.5
1 59.151.193.207
1 123.131.179.188
1 221.205.192.210
1 59.25.194.72
1 ppp85-141-130-24.pppoe.mtu-net.ru
1 117.104.245.29
Relay access denied (total: 4)
1 parestaurant.org
1 92.80.72.159
1 92.113.111.226
1 122.198.44.5
message reject warning detail: none
message hold detail: none
message discard detail: none
smtp delivery failures
———————-
connection refused (total: 3)
3 hjeigb.info
Warnings
——–
smtpd (total: 5)
1 99.178.220.164: hostname adsl-99-178-220-164.dsl.irvnca.sbcglob…
1 92.113.111.226: hostname 226-111-113-92.pool.ukrtel.net verific…
1 117.104.245.29: hostname 29.245.104.117.ids.service.eastern-tel…
1 Unable to look up MX host for pure1-mail.net: Host not found
1 Unable to look up MX host for amota8.co.il: Host not found
Fatal Errors: none
Panics: none
Master daemon messages: none
Per-Hour Traffic Summary
time received delivered deferred bounced rejected
——————————————————————–
0000-0100 2 1 1 1 1
0100-0200 3 3 1 0 3
0200-0300 3 2 1 0 2
0300-0400 4 4 1 0 0
0400-0500 3 2 0 0 4
0500-0600 4 4 1 0 6
0600-0700 0 0 0 0 0
0700-0800 0 0 0 0 0
0800-0900 0 0 0 0 0
0900-1000 0 0 0 0 0
1000-1100 0 0 0 0 0
1100-1200 0 0 0 0 0
1200-1300 0 0 0 0 0
1300-1400 0 0 0 0 0
1400-1500 0 0 0 0 0
1500-1600 0 0 0 0 0
1600-1700 0 0 0 0 0
1700-1800 0 0 0 0 0
1800-1900 0 0 0 0 0
1900-2000 0 0 0 0 0
2000-2100 0 0 0 0 0
2100-2200 0 0 0 0 0
2200-2300 0 0 0 0 0
2300-2400 0 0 0 0 0
Host/Domain Summary: Message Delivery (top 5)
sent cnt bytes defers avg dly max dly host/domain
——– ——- ——- ——- ——- ———–
3 8124 0 5.8 s 7.9 s yahoo.com
7 4175 0 3.2 s 3.2 s news.espacopublico.com.br
Host/Domain Summary: Messages Received (top 5)
msg cnt bytes host/domain
——– ——- ———–
3 6481 gmail.com
2 14562 alicensing.com
2 3238 chasey.com
top 5 Senders by message count
——————————
3 from=<>
2 c19remove@alicensing.com
2 ash22@chasey.com
top 5 Recipients by message count
———————————
1 noreply@news.espacopublico.com.br
top 5 Senders by message size
—————————–
17328 sophiew@ubi.com
14562 c19remove@alicensing.com
11353 from=<>
5238 noreply@news.espacopublico.com.br
top 5 Recipients by message size
——————————–
4175 noreply@news.espacopublico.com.br

