Backing up Mail Delivery Reports

scobiit

Member
Sep 24, 2014
19
0
1
cPanel Access Level
Root Administrator
Hello,

We have had a couple of occasions where we have needed to go back and look at the mail delivery reports on the server to find out that it has been longer than 30 days. I have seen in the settings we can extend this up to 365 days but am I right in thinking it reads the information from exim_mainlog? If so, is there a straight forward way (either via a bash script or a cron job) to back up the log files when they are rotated and modify the file name to keep them indefinitely (or until manually removed)?

Thank you in advance.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,884
2,243
463
I have seen in the settings we can extend this up to 365 days
Hello :)

Could you elaborate on the specific option you are referring to?

Thank you.
 

scobiit

Member
Sep 24, 2014
19
0
1
cPanel Access Level
Root Administrator
Hi Michael,

yes of course, when you are logged in I went to:
Tweak Settings >
Stats and Logs >
The interval, in days, to retain Exim stats in the database (Minimum: 1; Maximum: 365,000).

Which from what I have read should retain the mail delivery information to show whether they have arrived at the destination server (either incoming or outgoing). Ideally we would want to have a way of backing this up so we can create an archive in case we have to refer back to them a few months down the line.

Thanks again
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,884
2,243
463
The information that option is referring to is stored in the "eximstats" MySQL database. You could create a manual backup of this database if you prefer to not modify that option.

Thank you.
 

scobiit

Member
Sep 24, 2014
19
0
1
cPanel Access Level
Root Administrator
Hi again Michael,

Thanks for that, you might be able to answer another query following on from the above.
We have already sorted a remote backup to cover all of the home directory and attempted to create a cron job to back up the eximstats database to a subdirectory of home using mysqldump however it is behaving oddly. Although it does create a dump file it is only 280ish lines long however when I export the database via PHPMyAdmin it is over 40,000 lines? Is there a reason behind this?

Thanks again
 

scobiit

Member
Sep 24, 2014
19
0
1
cPanel Access Level
Root Administrator
Hi Michael,

I'm using as few options as I could as I just wanted to create a backup of all the tables. the command I used is below;

mysqldump --user=root --databases eximstats > /home/eximstats/`date +\\%Y-\\%m-\\%d`_backup.sql

Thanks again
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,884
2,243
463
You can repair or optimize the "eximstats" database with commands such as:

Code:
mysqlcheck --repair eximstats
mysqlcheck --optimize eximstats
However, try reviewing the actual tables that are backed up through the "mysqldump" utility as it should backup all of the necessary data.

Thank you.
 

scobiit

Member
Sep 24, 2014
19
0
1
cPanel Access Level
Root Administrator
Hi Michael,

I think we are getting our wires crossed a little on this. When I examine the dump files, it contains all the information required to recreate the tables but it is missing most of the lines of actual data which is what I want to back up. I have run the checks on eximstats anyway just to be on the safe side and none of the tables reported any errors.

Thanks again
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,884
2,243
463
Feel free to open a support ticket using the link in my signature so we can take a closer look. You can post the ticket number here so we can update this thread with the outcome.

Thank you.