Introduction
You may use the eximstats utility to generate email related reports in various formats (e.g. Text, HTML, XML, etc) to help understand how many messages are sent, errors that were encountered etc.
Please keep in mind that eximstats utility is not created by, provided by, or supported by cPanel. **
This guide is provided as an informational courtesy. Please review the eximstats manual and / or reach out to your systems administrator for further guidance on the use of this utility.
** cPanel does generate and maintain an Eximstats database that serves the data for the "Mail Delivery Reports" interface in WHM. However the use of the commandline eximstats utility is not related to the use of the cPanel eximstats database or Mail Delivery Reports interface in WHM.
Procedure
The easiest way to get started with the Eximstats utility is to simply run the following command via SSH as the root user on your cPanel server:
eximstats -txt /var/log/exim_mainlog
This is an example of a text report where everything but the section headings have been filtered out. Your server's report will be filled with actual data:
[root@srv001 ~]# eximstats -txt /var/log/exim_mainlog | grep --group-separator="" -B2 "^-"
Grand total summary
-------------------
Deliveries by transport
-----------------------
Messages received per hour (each dot is 1 message)
--------------------------------------------------
Deliveries per hour (each dot is 2 deliveries)
----------------------------------------------
Time spent on the queue: all messages
-------------------------------------
Time spent on the queue: messages with at least one remote delivery
-------------------------------------------------------------------
Relayed messages
----------------
Top 50 mail rejection reasons by message count
----------------------------------------------
Top 50 mail temporary rejection reasons by message count
--------------------------------------------------------
Top 50 sending hosts by message count
-------------------------------------
Top 50 sending hosts by volume
------------------------------
Top 50 host destinations by message count
-----------------------------------------
Top 50 host destinations by volume
----------------------------------
Top 50 local destinations by message count
------------------------------------------
Top 50 local destinations by volume
-----------------------------------
Top 50 rejected ips by message count
------------------------------------
Top 50 temporarily rejected ips by message count
------------------------------------------------
If you wanted to generate a report for only the month of September in 2021, you could use the following script to filter out only September's logs and place them into a new log file in the root home directory:
zgrep -h "2021-09" /var/log/exim_mainlog* | sort -n > /root/exim-mainlog-september-2021.log
Then, you would be able to use eximstats on that new September only log file to see the statistics.
Here we can see that so far for the month of September my testing server has delivered a total of 509 messages and has received 312:
[root@srv001 ~]# eximstats -txt /root/exim-mainlog-september-2021.log | head -12
Exim statistics from 2021-09-01 00:58:27 to 2021-09-25 23:29:26
Grand total summary
-------------------
At least one address
TOTAL Volume Messages Addresses Hosts Delayed Failed
Received 17MB 312 37 1 0.3% 6 1.9%
Delivered 3463KB 509 509 7
Rejects 1486 603
Temp Rejects 141 7
It is also possible to merge two reports together. For example if you had these two date ranged reports for the first two parts of September:
[root@srv001 ~]# zgrep -E -h "2021-09-0[1-9]" /var/log/exim_mainlog* | sort -n > /root/exim-mainlog-september-01-09-2021.log
[root@srv001 ~]# zgrep -E -h "2021-09-1[0-9]" /var/log/exim_mainlog* | sort -n > /root/exim-mainlog-september-10-19-2021.log
It would be possible to merge those reports into one with eximstats like this.
Generate the separate reports:
[root@srv001 ~]# eximstats -txt=/root/exim-Sep-01-09.report /root/exim-mainlog-september-01-09-2021.log
[root@srv001 ~]# eximstats -txt=/root/exim-Sep-10-19.report /root/exim-mainlog-september-10-19-2021.log
Then combine the generated reports into a larger range:
[root@srv001 ~]# eximstats -merge /root/exim-Sep*.report > /root/exim-Sep-01-19.report
There are many other useful features that you may explore in the manual page for the eximstats utility:
https://linux.die.net/man/8/eximstats
Comments
0 comments
Article is closed for comments.