Difference between revisions of "Email Statistics"

From SME Server
Jump to navigationJump to search
Line 3: Line 3:
 
===Brian Read's spamfilter-stats-7.pl===
 
===Brian Read's spamfilter-stats-7.pl===
 
Brian Read's mailstats.pl script analyzes your qpsmtpd log files and sends a daily email to "admin" summarizing that day's email activity.
 
Brian Read's mailstats.pl script analyzes your qpsmtpd log files and sends a daily email to "admin" summarizing that day's email activity.
<nowiki>wget -O /etc/cron.d/mailstats.cron http://mirror.contribs.org/smeserver/contribs/bread/mailstats/mailstats.cron</nowiki>
 
<nowiki>wget -O /usr/bin/spamfilter-stats-7.pl http://mirror.contribs.org/smeserver/contribs/bread/mailstats/spamfilter-stats-7.pl</nowiki>
 
'''WARNING''': Make sure that these files are accessible before executing the above commands!  If you are unable to access http://mirror.contribs.org/smeserver/contribs/bread/mailstats/ the above commands will create empty files!
 
  
The email recipient is specified in the spamfilter-stats-7.pl file, currently at line 108, using:
+
====Download & Installation====
 +
<nowiki>wget -O /etc/cron.d/mailstats.cron \
 +
http://mirror.contribs.org/smeserver/contribs/bread/mailstats/mailstats.cron</nowiki>
 +
<nowiki>wget -O /usr/bin/spamfilter-stats-7.pl \
 +
http://mirror.contribs.org/smeserver/contribs/bread/mailstats/spamfilter-stats-7.pl</nowiki>
 +
'''WARNING''': Make sure that these files are accessible before executing the above commands!  If you are unable to access http://mirror.contribs.org/smeserver/contribs/bread/mailstats/ the above commands will create empty files, overwriting existing versions.
 +
 
 +
====Change Email Recipient====
 +
The email recipient is specified in the spamfilter-stats-7.pl file, currently (v0.6.11) at line 108, using:
 
   $opt{'mail'}    = "admin";
 
   $opt{'mail'}    = "admin";
 +
which will deliver email to the local 'admin' account on your SME server.  Configure email forwarding in server-manager::Collaboration::Users::admin to deliver the emails to another location.
 +
 +
====Handling @*.u Logfiles====
 +
Multilog occasionally generates log files that end in ".u" instead of ".s".  The [http://cr.yp.to/daemontools/multilog.html| multilog manual] says this:
 +
* ''.s: This file is completely processed and safely written to disk.''
 +
* ''.u: This file was being created at the moment of an outage. It may have been truncated. It has not been processed.''
 +
 +
While these files should not be generated under normal circumstances, they are (as attested by personal experience, forum posts and bug reports).  In order to include these files when reporting email statistics, you will need to modify /etc/cron.d/mailstats.cron by changing
 +
0    0  *    *  *    root    perl /usr/bin/spamfilter-stats-7.pl /var/log/qpsmtpd/'''*.s''' /var/log/qpsmtpd/current
 +
to
 +
0    0  *    *  *    root    perl /usr/bin/spamfilter-stats-7.pl /var/log/qpsmtpd/'''*.[us]''' /var/log/qpsmtpd/current
 +
or
 +
0    0  *    *  *    root    perl /usr/bin/spamfilter-stats-7.pl /var/log/qpsmtpd/'''@*''' /var/log/qpsmtpd/current
  
 
----
 
----
 
[[Category:Howto]]
 
[[Category:Howto]]

Revision as of 21:24, 28 July 2007

Email Statistics

How to get statistics about the performance of your mail server

Brian Read's spamfilter-stats-7.pl

Brian Read's mailstats.pl script analyzes your qpsmtpd log files and sends a daily email to "admin" summarizing that day's email activity.

Download & Installation

wget -O /etc/cron.d/mailstats.cron \
http://mirror.contribs.org/smeserver/contribs/bread/mailstats/mailstats.cron
wget -O /usr/bin/spamfilter-stats-7.pl \
http://mirror.contribs.org/smeserver/contribs/bread/mailstats/spamfilter-stats-7.pl

WARNING: Make sure that these files are accessible before executing the above commands! If you are unable to access http://mirror.contribs.org/smeserver/contribs/bread/mailstats/ the above commands will create empty files, overwriting existing versions.

Change Email Recipient

The email recipient is specified in the spamfilter-stats-7.pl file, currently (v0.6.11) at line 108, using:

 $opt{'mail'}     = "admin";

which will deliver email to the local 'admin' account on your SME server. Configure email forwarding in server-manager::Collaboration::Users::admin to deliver the emails to another location.

Handling @*.u Logfiles

Multilog occasionally generates log files that end in ".u" instead of ".s". The multilog manual says this:

  • .s: This file is completely processed and safely written to disk.
  • .u: This file was being created at the moment of an outage. It may have been truncated. It has not been processed.

While these files should not be generated under normal circumstances, they are (as attested by personal experience, forum posts and bug reports). In order to include these files when reporting email statistics, you will need to modify /etc/cron.d/mailstats.cron by changing

0    0   *    *   *    root    perl /usr/bin/spamfilter-stats-7.pl /var/log/qpsmtpd/*.s /var/log/qpsmtpd/current

to

0    0   *    *   *    root    perl /usr/bin/spamfilter-stats-7.pl /var/log/qpsmtpd/*.[us] /var/log/qpsmtpd/current

or

0    0   *    *   *    root    perl /usr/bin/spamfilter-stats-7.pl /var/log/qpsmtpd/@* /var/log/qpsmtpd/current