On Wed, 2 Apr 2003 10:53 pm, Andre Luis Lopes wrote:
>    Actually, I'm already using pflogsum but it doesn't seems to support
> generating the kind of report I'm looking for. It's good enough for
> generating statistics about a lot of useful data, but what I would like
> to see in a report is something like :
>
> Message ID    Sender               Recipient           Size
> XXXXX         [EMAIL PROTECTED]        [EMAIL PROTECTED]       XXX

This is for courier-mta and realtime stats but it could be tweaked for
postfix, message-id and file output.

# cat /usr/local/sbin/maillog
#!/bin/sh

tail -f /var/log/mail/mail.log | \
 awk -W interactive -F, ' \
  /Message delivered./ { \
  print \
  substr($4,6)"\t" \
  substr($3,7,length($3)-7)" \033[1;32m<-\033[0m " \
  substr($2,7,length($2)-7) \
 } \
  /status: success/ { \
  print \
  substr($4,6)"\t" \
  substr($2,7,length($2)-7)" \033[1;31m->\033[0m " \
  substr($3,7,length($3)-7) \
 }'

--markc


Reply via email to