Symptoms
If you are experiencing corruption in the sqlite database such as:
[2716099] [2020-08-19 04:00:23 -0300] [Cpanel::TailWatch::Eximstats] [ERR] SQL Failed with error ((XID fjsv3e) The system received an error from the “SQLite” database “/var/cpanel/eximstats_db.sqlite3”: SQLITE_CONSTRAINT (UNIQUE constraint failed: failures.sendunixtime, failures.msgid, failures.email, failures.deliveredto)):
You will need to rebuild the exim database.
Procedure
1. Stop tailwatchd
/scripts/restartsrv_tailwatchd --stop
2. Stop eximstats
/scripts/restartsrv_eximstats --stop
3. Move the eximstats database
mv /var/cpanel/eximstats_db.sqlite3 /var/cpanel/eximstats_db.sqlite3.original
4. Recreate the database
/usr/local/cpanel/bin/updateeximstats
5. Import exim data
/scripts/import_exim_data /var/log/exim_mainlog
6. Regenerate the database
/scripts/slurp_exim_mainlog --force
7. Restart eximstats
/scripts/restartsrv_eximstats
8. Restart tailwatchd
/scripts/restartsrv_tailwatchd --start