Exim relay daily stats – bash

#!/bin/bash
ESEND=$(egrep "(=>|->)" /var/log/exim4/mainlog.1 -c)
YDATE=$(date -d "1 day ago" '+%Y-%m-%d')
echo
echo -== Report for $YDATE ==-
echo
echo Total emails send by SMTP relay on $HOSTNAME:
echo
egrep "(=>|->)" /var/log/exim4/mainlog.1 | gawk '{ print $5 }'| sort | uniq -c | sort -nr
echo
echo Total: $ESEND
echo

output:

/root/exim-stats.sh

-== Report for 2016-02-28 ==-

Total emails send by SMTP relay on some.hostname:

20 someone@example.com
10 someone_else@email.com
1 sales@domain.com

Total: 31

Advertisements


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s