Mailstats
| Maintainer | brianr (aka Brian Read) |
|---|---|
| Source: | https://src.koozali.org/smecontribs/smeserver-mailstats.git |
| Category | |
| Tags | stats, email, spam, spamassassin, qpsmtpd |
Version
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.
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=smecontribsThere 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.sqlIt might be a good idea to delete the DB configuration as well:
config delete mailstatsDo 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
| ID | Product | Version | Status | Summary (16 tasks) ⇒ |
|---|---|---|---|---|
| 13327 | SME Contribs | 11.0 | CONFIRMED | NFR: add nightly postfix stats from/similar to logwatch |
| 13320 | SME Contribs | Futur | CONFIRMED | Javascript failures on front panel |
| 13242 | SME Contribs | 11.0 | CONFIRMED | Make the report and html work for other languages. |
| 13241 | SME Contribs | 11.0 | CONFIRMED | External connection count is very much higher than table indicates |
| 13236 | SME Contribs | 11.0 | CONFIRMED | Add arithmetic test/comparison of totals versus broken down totals |
| 13233 | SME Contribs | 11.0 | CONFIRMED | Wrong DB user created |
| 13216 | SME Contribs | 11.0 | CONFIRMED | spam Blacklist result ignored by Mailstats |
| 13204 | SME Contribs | 11.0 | RESOLVED | Fix Apache 2.4 directive to control access to /opt/mailstats |
| 13197 | SME Contribs | 11.0 | CONFIRMED | Add mailstats version to left hand table |
| 13196 | SME Contribs | 11.0 | CONFIRMED | Geoip Percentage column does not have % sign |
| 13121 | SME Contribs | 11.0 | RESOLVED | Overall Development and testing of smeserver-mailstats during SME11 beta |
| 13118 | SME Contribs | 11.0 | RESOLVED | Initial install does not create Status DB entry |
| 13117 | SME Contribs | 11.0 | RESOLVED | SME11 Mailstats Run time error |
| 13116 | SME Contribs | 11.0 | RESOLVED | First version for SME11, with SM2 panel |
| 12841 | SME Contribs | 11.0 | RESOLVED | Update Mailstats (perl and python) to accommodate SME11 log format. |
| 10251 | SME Contribs | Futur | CONFIRMED | NFR re add spamassassin tag stats |