Difference between revisions of "Email Statistics"

From SME Server
Jump to navigationJump to search
(how to force (initial) qpsmtpd log rotation; how to recover from missing /var/log/qpsmtpd/state)
Line 15: Line 15:
 
e-smith-viewlogfiles-1.8.0-4 (released Nov 28 2007) or later will allow you to 'View' /var/log/qpsmtpd/state from 'View log files' in the server-manager (earlier versions conceal all files named "state" - [[bugzilla:3416|Bug 3416]]).
 
e-smith-viewlogfiles-1.8.0-4 (released Nov 28 2007) or later will allow you to 'View' /var/log/qpsmtpd/state from 'View log files' in the server-manager (earlier versions conceal all files named "state" - [[bugzilla:3416|Bug 3416]]).
  
Currently, qplogsumm.pl is disabled by default.  Enable it with
+
=====Enable qplogsumm=====
 +
qplogsumm.pl is disabled by default.  Enable it with
 
  config setprop qpsmtpd qplogsumm enabled
 
  config setprop qpsmtpd qplogsumm enabled
 
  signal-event email-update
 
  signal-event email-update
 +
 +
=====Force first log rotation=====
 +
qplogsumm.pl only updates its statistics when the qpsmtpd log file is rotated.  This can take several days on a moderately busy server, and might take weeks or months on a small, home server.
 +
 +
You can force a rotation of the qpsmtpd log files in order to generate initial data in [[tt]/var/log/qpsmtpd/state[/tt] using
 +
kill -ALRM `cat /var/service/qpsmtpd/log/supervise/pid`
 +
 +
=====Potential Problems=====
 +
qplogsumm.pl will completely lock all in-bound email if [tt]/var/log/qpsmtpd/state[/tt] is missing when multilog attempts to rotate the qpsmtpd log file.  This can be resolved using
 +
  touch /var/log/qpsmtpd/state
 +
  sv restart /var/log/qpsmtpd
  
 
===Contribs & Addons===
 
===Contribs & Addons===

Revision as of 15:39, 5 October 2008

Email Statistics

How to get statistics about the performance of your mail server

Built-In Statistical Reports

Server-Manager

Some email statistics can be seen from server-manager under "Administration", "Mail log file analysis"

qplogsumm.pl

SME 7.2 and later include the 'logterse' plugin to qpsmtpd as well as the 'qplogsumm.pl' statistics script.

qplogsumm.pl updates /var/log/qpsmtpd/state with per-plugin statistics for any qpsmtpd plugin that appears in a qpsmtpd logterse entry each time the qpsmtpd log is rotated.

Sample output here

e-smith-viewlogfiles-1.8.0-4 (released Nov 28 2007) or later will allow you to 'View' /var/log/qpsmtpd/state from 'View log files' in the server-manager (earlier versions conceal all files named "state" - Bug 3416).

Enable qplogsumm

qplogsumm.pl is disabled by default. Enable it with

config setprop qpsmtpd qplogsumm enabled
signal-event email-update
Force first log rotation

qplogsumm.pl only updates its statistics when the qpsmtpd log file is rotated. This can take several days on a moderately busy server, and might take weeks or months on a small, home server.

You can force a rotation of the qpsmtpd log files in order to generate initial data in [[tt]/var/log/qpsmtpd/state[/tt] using

kill -ALRM `cat /var/service/qpsmtpd/log/supervise/pid`
Potential Problems

qplogsumm.pl will completely lock all in-bound email if [tt]/var/log/qpsmtpd/state[/tt] is missing when multilog attempts to rotate the qpsmtpd log file. This can be resolved using

 touch /var/log/qpsmtpd/state
 sv restart /var/log/qpsmtpd

Contribs & Addons

Brian Read's spamfilter-stats-7.pl

Brian Read's mailstats contrib analyzes your qpsmtpd log files and sends an email to the specified email address summarizing your SME server activity.

Full details can be found at mailstats

Qmail_Statistics_(AWStats)

Michael Weinberger has assembled a script that allows you to easily install awstats and configure it to provide email delivery statistics.

Full details can be found at Qmail_Statistics_(AWStats)

qplogtail

qplogtail is a script intended to help monitor /var/log/qpsmtpd/current and extract a concise but meaningful display of what the server is up to.

qplogtail extracts 6 kinds of information:

  1. Normal connections:
    28545 Accepted connection 4/30 from 86.139.2.73 ...
  2. Errors in violation of Instances:
    5146 Too many connections: 40 >= 40. Waiting one second.
  3. Errors in violation of InstancesPerIP:
    5320 hosts_allow plugin: Too many connections from 212.100.229.201: 6 > 5Denying connection.
  4. Messages blocked by any qpsmtpd plugin:
    15751 logging::logterse plugin: ` 82.210.181.241 241-pra-6.acn.waw.pl 241-pra-6.acn.waw.pl <Glasteinzhza@ask-it-here.com> dnsbl 903 http://www.spamhaus.org/query/bl?ip=82.210.181.241 msg denied before queued
  5. Messages queued for delivery:
    15587 logging::logterse plugin: ` 128.220.32.40 miami.deuvis.com miami.deuvis.com <aapple@deuvis.com> <c.wolf@ncxr.org> queued <200709270344.l8R3iq0b010299@deuvis.com> No, hits=-2.6 required=5.0_
  6. Connection time values from the connection_time plugin (if present)
    @4000000048641d5c0951f6a4 15110 connection_time plugin: Connection time from 209.74.246.66: 1.566 sec.

Each normal smtp transaction will generate two lines of output containing:

msgid   remote_ip   x/40
msgid   remote_ip   dispostion   details

If you have the connection_time plugin installed, you will also get:

msgid   remote_ip   timeconnected

Sample output:

# qplogtail
14868   209.74.246.66   0/40
14868   209.74.246.66   check_basicheaders      msg denied before queued
14868   209.74.246.66   1.622 sec.
14879   200.127.59.114  0/40
14879   200.127.59.114  dnsbl   msg denied before queued
14879   200.127.59.114  2.874 sec.
14890   69.147.64.214   0/40
14890   69.147.64.214   queued  No, hits=-2.6 required=5.0_
14890   69.147.64.214   7.433 sec.


To install:

cd /usr/local/bin
wget -O qplogtail http://bugs.contribs.org/attachment.cgi?id=2035
chmod 755 qplogtail

To run:

qplogtail


Direct comments or questions to Bugzilla:3418

Qpsmtpd_connection_time

See qpsmtpd_connection_time