20090407

Summary of the mail traffic size

Today I've written a handy oneliner to get a summary of mail traffic size for a current/yesterday period of log time.
Sun Java Messaging Server denotes the size (sz) of every message in kilobytes, accordingly to the (MTA) BLOCK_SIZE variable (default value: 1024 bytes).

For example, to get the yesterday sum of messages being sent to domain.com (single-tiered architecture):

sed '/tcp_local.*ims-ms.*domain.com/p;d' mail.log_yesterday | awk '{ SIZE+=$6 } END { print SIZE/1024 }'

The returned value will be presented in Mb.

To get a similar check for frontend-backend (two-tiered) scenario, with LMTP, and for a current log file:

sed '/tcp_local.*tcp_lmtpcs.*domain.com/p;d' mail.log_current | awk '{ SIZE+=$6 } END { print SIZE/1024 }'


To engage a command for the outbound messages I've used a tcp_auth channel name as a significant mark.

# sed '/tcp_auth.*wisnios.com/p;d;' mail.log_yesterday | awk '{ SIZE+=$6 } END { print SIZE/1024 }'
102.645

No comments: