Unable to delete campaign delivery logs

mwizz98

Member
I had the 'delete campaign delivery logs' option set to 'no' for a long time, and the log size got pretty big:

Bash:
5.7G    /var/lib/mysql/mailwizz/mw_campaign_delivery_log.ibd

I changed it to 'yes' in the backend and waited 24 hrs but the size did not change, and it definitely should have deleted 95% of it if it's only gonna keep 5 days or even 30 days.

I ran the command to see what's going on:

Bash:
~]$ /usr/bin/php -q /var/www/html/apps/console/console.php delete-campaign-delivery-logs --verbose=1
] - Loading 50 campaigns to delete their delivery logs...
] - No campaign found for deleting its delivery logs!
] - Done!

The campaigns have all finished sending long ago and they are not autoresponders. how can I fix this? Thank you.
 
The size of the ibd file will not change regardless of what you delete, this is just how mysql works.
 
Thank you for your reply. I did some googling also and I have a better understanding of how that works.

The reason I was trying to delete campaign logs is to see if I could get better performance.

I am still facing this mysterious issue where I send to 40k subscribers (new list) at 10,000 emails per hour, the system remains very stable, CPU is around 25% and ram usage is reasonable as well.

But when I send to an old list with 10k subscribers that I've sent many campaigns to (99% of the logs are from this list), CPU jumps to 100% and the system becomes unstable. I thought maybe it was because mysql was loading all the logs for that list into memory in order to append new ones or something like that. I have not tested after deleting the campaign logs, I will test later this week.

Same server, same email (no custom fields), same delivery server, same settings, same everything, only the list is the different. Pretty odd.
 
Last edited:
Another note, even after deleting campaign delivery logs, when I click 'campaign delivery logs' in the backend, the application just times out. I cannot load that page. cpu load and ram go up.
 
Last edited:
Well, 10M records is not a small thing, you might not be able to access the logs page given this amount, but that should not hinder your ability to use the app, you should be able to send emails just fine.
This number should be lower if more campaigns match the requirements for log removal.
 
I have only like 6 campaigns in the past 30 days, total emails sent less than 200k. That's why I thought something strange was going on.

I checked some of the records in that table, and they go back to 2018, so it looks like old records are not being deleted even though I changed the 'delete campaign delivery logs' option to 'yes'.

Any idea why this is happening and how we could fix it? I can assure you that the campaigns match the requirement for log removal. They are not autoresponders, and they are in 'Sent (100%)' status. I can run any commands you want if you want to check things.

Here's a sample record:

Code:
mysql> SELECT * FROM mw_campaign_delivery_log WHERE log_id=2000005;
+---------+-------------+---------------+-----------+---------+-----------+---------+-------------+-------------------------------------------------+--------------------+---------+---------------------+
| log_id  | campaign_id | subscriber_id | server_id | message | processed | retries | max_retries | email_message_id                                | delivery_confirmed | status  | date_added          |
+---------+-------------+---------------+-----------+---------+-----------+---------+-------------+-------------------------------------------------+--------------------+---------+---------------------+
| 2000005 |          87 |        361997 |      NULL | OK      | no        |       0 |           3 | <redacted>                                      | yes                | success | 2018-11-07 07:40:15 |
 
I have only like 6 campaigns in the past 30 days, total emails sent less than 200k.
I doubled checked this and MailWizz looks for campaigns that have finished at least 30 days ago, and will remove logs only for those.
If you want it to delete more recent ones, you need to set a custom application param:
PHP:
'campaign.delivery.logs.delete.days_back' => 5,
as explained at https://www.mailwizz.com/kb/adding-custom-configuration-params/

So all I can tell you is that if you meet those requirements, the logs will be removed.
 
I do not want it to delete more recent ones, I want it to delete all those old logs from 2018 until 30 days ago (see the date_added of the example I posted above), that's where the issue is. 98% of the logs are older than 30 days. Mailwizz doesn't seem to be deleting them for some reason.
 
You can open a ticket with backend url and access together with SSH access to the server and we can try and see what is going on.
 
I just found the problem!

I checked an archived campaign:

  • Started at10/19/18, 2:45 AM
  • Finished at5/25/24, 8:45 PM

Wow. It looks like when I archived it, it changed the Finished date.

I just unarchived and archived some campaigns, and it changed the Finished date to today's date. So I guess those recent finish dates is why it wasn't deleting logs.
 
Last edited:
It looks like if I just wait 30 days or so, it will delete all the other old logs.

Quick question here, do you recommend optimizing the table once all old logs are deleted?
 
Back
Top