Thursday, 12 December 2013

Find Bandwidth usage of email accounts

I would start by checking how many bytes the account  is receiving per POP3 connection and to also find out how frequent he/she is accessing the mail service..

This should help - give the below command a shot:

grep user@domain.com /var/log/maillog* | grep retr= | awk {'print $6" "$1" "$2" "$3" "$11'} | grep -v retr=0

Now one on the whole domain
 grep domain.com  /var/log/maillog* | grep retr= | awk {'print $6" "$1" "$2" "$3" "$11'} | grep -v retr=0

The below command will give you the total bytes transferred.

 grep domain.com /var/log/maillog* | grep retr= | grep -v retr=0 | awk {'print $11'} | cut -d, -f1 | cut -d= -f2 | awk '{t += $1} END { print "total: ", t, " bytes transferred over POP3"}'

No comments:

Post a Comment