Mailstats

From SME Server
Jump to navigationJump to search



Version

smecontribs-testing 11:
smecontribs 10:
smetest 9:
smecontribs 9:
smeserver-mailstats
The latest version of smeserver-mailstats is available in the SME repository, click on the version number(s) for more information.


Mailstats

The mailstats contrib analyzes the logs created by qpsmtpd (and its other incarnations sqpsmtpd and uqpsmtpd) and sends a periodic email to the address you specify summarizing your server's email activity for the day on an hourly basis.

Mailstats has been re-written for SME11 and now supports html email and webpage, and allows drill down

The latest version also supports storing the summary logs in a MySQL database. This is available for offline for further analysis, and also allows a drill down to the summary logs for an hour and also to the original log entries for each transaction.

Mailstats now has its own Server Manager panel as well, which allows the reports and graphs to be seen inside Server Manager, and also allows many of the importent parameters to be configured.


Important.png Note:
For GeoIP reporting you will need updated rpms and GeoIP plugin for spamassassin - please see the GeoIP wiki page https://wiki.contribs.org/GeoIP


Gallery

Installation

for SME11:

dnf install smeserver-mailstats --enablerepo=smecontribs,epel

Once installed, then mailstats will run over night (just after midnight), and send the email by default to admin. This can changed.

Manual report generation

You can use the following command to generate a report for a specific day

runmailstats.sh yyyy-mm-dd

Leaving out the date will give a report for yesterday. Using this command you could generate mailstats reports for days before mailstats was installed.

If you want to generate mailstats for all previous days for which there may be data, then run:

runallmailstats.sh

This will populate the summary logs for each day since the first journal entry for qpsmtpd , and send the stats to the designated email.

Keeping the logs

Logs are rotated according to values in /etc/systemd/journal.conf, suggest you read it up to understand how it works, the default is to occupy a max of 4g of disc, which means that often detailed logs will disappear quite soon, depending on your traffic. On my system which receives around 800 emails a day (including ones that are not delivered due to being spam), the system keeps about 7 days of logs.

Please bear in mind that the maximum default for Journalctl is that logs are kept for 95 days only. This can be altered by judicial editting of /etc/systemd/journald.conf.

Server manager Panel

Under Investigation the Mailstats panel will allow the examination of yesterday and previous days reports, plus configuring the specific configurations for mailstats (email, etc), but also other relevant parameters to spamassassin and qpsmtpd.

Troubleshooting from previous versions

If you have migrated your data from SME10, or run earlier versions of mailstats, then you may find that the mailstats program is unable to connect to the MariaDB database (called "mailstats"!). In this case you may need to delete the current mailstats database and re-install smeserver-mailstats.

You can delete the current mailstats DB by:

mysql -e "DROP DATABASE IF EXISTS mailstats;"

You can re-install the same rpm over the top of the one there by:

dnf reinstall smeserver-mailstats --enablerepo=smecontribs

There may be files left from the old version of mailstats, you can delete these by:

rm -f /etc/e-smith/sql/init/99smeserver-mailstats.sql
rm -f /etc/e-smith/templates/etc/e-smith/sql/init/99smeserver-mailstats.sql

It might be a good idea to delete the DB configuration as well:

config delete mailstats

Do all this before doing the reinstall,

The future

It is hoped to enhance mailstats further by (re) adding spamassin rules league table and also allow drill down by cell instead of the complete hour.

It would be nice to only allow the drill down to the details if the logs are actually available.

There also might be a few more eye-candy changes!

Bug Reporting & Tracking

Please raise bugs under the SME-Contribs section in bugzilla and select the smeserver-mailstats component or use this link: smeserver-mailstats


smeserver-mailstats - Outstanding bugs

IDProductVersionStatusSummary (16 tasks)
13327SME Contribs11.0CONFIRMEDNFR: add nightly postfix stats from/similar to logwatch
13320SME ContribsFuturCONFIRMEDJavascript failures on front panel
13242SME Contribs11.0CONFIRMEDMake the report and html work for other languages.
13241SME Contribs11.0CONFIRMEDExternal connection count is very much higher than table indicates
13236SME Contribs11.0CONFIRMEDAdd arithmetic test/comparison of totals versus broken down totals
13233SME Contribs11.0CONFIRMEDWrong DB user created
13216SME Contribs11.0CONFIRMEDspam Blacklist result ignored by Mailstats
13204SME Contribs11.0RESOLVEDFix Apache 2.4 directive to control access to /opt/mailstats
13197SME Contribs11.0CONFIRMEDAdd mailstats version to left hand table
13196SME Contribs11.0CONFIRMEDGeoip Percentage column does not have % sign
13121SME Contribs11.0RESOLVEDOverall Development and testing of smeserver-mailstats during SME11 beta
13118SME Contribs11.0RESOLVEDInitial install does not create Status DB entry
13117SME Contribs11.0RESOLVEDSME11 Mailstats Run time error
13116SME Contribs11.0RESOLVEDFirst version for SME11, with SM2 panel
12841SME Contribs11.0RESOLVEDUpdate Mailstats (perl and python) to accommodate SME11 log format.
10251SME ContribsFuturCONFIRMEDNFR re add spamassassin tag stats