This article applies to:
- DLP Protect Email (all versions)
Question:
- Is there any way I can get a list of sent emails?
PROCEDURE:
The script below assumes that you have changed your /etc/logrotate.conf to do a daily rotation and that you are compressing and keeping 6 or more days of logs.
Log in to your device as root
crontab -e
paste the following in (note that this text is in a scrolling region; please be sure you have copied all the text).
# created to email daily mail logs to users at 1:10am and weekly reports at 1:20am on Sundays
# They are emailed to the local user postmaster, the email addresses are set in /etc/aliases
# Once changes are made run 'postalias /etc/aliases' to update the system with the changes
0 1 * * * (zcat /var/log/maillog.1.gz ; cat /var/log/maillog ) |/usr/sbin/pflogsumm --problems_first -d yesterday -h 20 --no_no_msg_size -u20 | mail -s "`uname -n` daily mail stats for `date '+%F'`" postmaster
10 1 * * 0 (zcat /var/log/maillog.6.gz; zcat /var/log/maillog.5.gz; zcat/var/log/maillog.4.gz ; zcat /var/log/maillog.3.gz; zcat /var/log/maillog.2.gz;zcat /var/log/maillog.1.gz; cat /var/log/maillog) | /usr/sbin/pflogsumm--problems_first -h 20 --no_no_msg_size -u 20 |mail -s "`uname -n`weekly mail stats for `date --date="-7 days" +%F`" postmaster
20 1 1 * * (zcat /var/log/maillog.*.gz ; cat /var/log/maillog) |/usr/sbin/pflogsumm --problems_first -h 20 --no_no_msg_size -u 20 | mail -s" `uname -n`Monthly mail stats for `date --date="lastmonth" +%Y-%m`" postmaster
To change the time look at the following
* * * * * command to be executed
| | | | |
| | | | .---- day of week (0 - 6) (Sunday=0 or 7)OR sun,mon,tue,wed,thu,fri,sat
| | | .------- month (1 - 12) OR jan,feb,mar,apr ...
| | .---------- day of month (1 - 31)
| .------------- hour (0 - 23)
.---------------- minute (0 - 59)
Sample Report:
You can get a report that looks like the following example:
Postfix log summaries for Aug 18
Grand Totals
------------
messages
22 received
17 delivered
6 forwarded
0 deferred
0 bounced
2 rejected (10%)
0 reject warnings
0 held
0 discarded (0%)
410520 bytes received
416588 bytes delivered
5 senders
2 sending hosts/domains
5 recipients
2 recipient hosts/domains
message deferral detail: none
message bounce detail (by relay): none
message reject detail
---------------------
RCPT
Sender address rejected: Access denied (total: 2)
2<>
message reject warning detail: none
message hold detail: none
message discard detail: none
smtp delivery failures: none
Warnings: none
Fatal Errors: none
Panics: none
Master daemon messages: none
Per-Hour Traffic Summary
time received delivered deferred bounced rejected
--------------------------------------------------------------------
0000-0100 0 0 0 0 0
0100-0200 1 1 0 0 1
0200-0300 0 0 0 0 0
0300-0400 0 0 0 0 0
0400-0500 1 1 0 0 1
0500-0600 0 0 0 0 0
0600-0700 0 0 0 0 0
0700-0800 0 0 0 0 0
0800-0900 7 4 0 0 0
0900-1000 13 11 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
sent cnt bytes defers avg dly max dlyhost/domain
-------- ------- ------- ------- ------- -----------
1223924 0 0.1s 1.0 s sup-domain1.com
5392664 0 0.2s 1.0 s verincent.com
Host/Domain Summary: Messages Received
msg cnt bytes host/domain
-------- ------- -----------
10 399408 sup-domain1.com
6 11112sup-protect-8-2.sup-domain1.com
Senders by message count
------------------------
6 supcon-8-2@sup-domain1.com
5 root@sup-protect-8-2.sup-domain1.com
3 alavies@sup-domain1.com
1 ALavies@sup-domain1.com
1 verincent@sup-protect-8-2.sup-domain1.com
Recipients by message count
---------------------------
6 alavies@sup-domain1.com
5 adminstrator@sup-domain1.com
3 alavies@verincent.com
2 kconnel@verincent.com
1 kconnel@sup-domain1.com
Senders by message size
-----------------------
293394 alavies@sup-domain1.com
98127 ALavies@sup-domain1.com
9920 root@sup-protect-8-2.sup-domain1.com
7887 supcon-8-2@sup-domain1.com
1192 verincent@sup-protect-8-2.sup-domain1.com
Recipients by message size
--------------------------
196739 alavies@verincent.com
195925 kconnel@verincent.com
11810 alavies@sup-domain1.com
7048 adminstrator@sup-domain1.com
5066 kconnel@sup-domain1.com
=================================================
Notes:
If you have any questions please contact TAC@trustwave.com.