Delete delivery and bounce logs?

Lakjin

Active Member
Campaign delivery log and server usage log are getting huge on my server. Do I need to keep them? If not, how can I delete them?

Thanks!
 

Rob

Active Member
I would zip them up and store them somewhere else, or if you have the ability where you are hosting attach some NAS and map the log file locations to there.
 

twisted1919

Administrator
Staff member
Those are kept only to calculate the servers sending quota and customers sending quota.
However, you can always delete records older than a month for example.
 

Lakjin

Active Member
Those are kept only to calculate the servers sending quota and customers sending quota.
However, you can always delete records older than a month for example.
Is it possible to automate this cleanup from within MailWizz? I'd prefer not to write my own script that directly modifies the database table.
 

twisted1919

Administrator
Staff member
Of course, open apps/console/commands/DailyCommand.php and have a look inside, it'll make sense how you can change it.
 

Lakjin

Active Member
Okay, so the fix you suggested worked for mw_delivery_server_usage_log but not for mw_campaign_delivery_log
 

twisted1919

Administrator
Staff member
If you delete from campaign_delivery_log, then stats for the old campaigns will be affected and i am not sure you want that, and if you'd want that you might as well delete the campaigns.

There's a feature in mailwizz, that hasn't been tested that much, but that allws you to move logs from campaign_delivery_log into another table, in campaign_delivery_log_archive so that you keep your original table as slim as possible.
The file that does this is apps/console/commands/ArchiveCampaignsDeliveryLogsCommand.php and can be triggered from command line with: php -q /absolutre/path/to/apps/console/console.php archive-campaigns-delivery-logs
However, you'll want to go through that file first because it tried to do some heavy lifting and you need to make sure your server can handle this. There's no guarantee for it to work.

Thanks.
 

Lakjin

Active Member
If you delete from campaign_delivery_log, then stats for the old campaigns will be affected and i am not sure you want that, and if you'd want that you might as well delete the campaigns.

There's a feature in mailwizz, that hasn't been tested that much, but that allws you to move logs from campaign_delivery_log into another table, in campaign_delivery_log_archive so that you keep your original table as slim as possible.
The file that does this is apps/console/commands/ArchiveCampaignsDeliveryLogsCommand.php and can be triggered from command line with: php -q /absolutre/path/to/apps/console/console.php archive-campaigns-delivery-logs
However, you'll want to go through that file first because it tried to do some heavy lifting and you need to make sure your server can handle this. There's no guarantee for it to work.

Thanks.
I think I'll keep it as is right now... I was just trying to save space, the speed of the table itself is not an issue at the moment.
 

twisted1919

Administrator
Staff member
If it helps, i have just added some perfomance flags that one, depending on how he uses mailwizz, can use.
These are the flags:
PHP:
return array(
    'MW_PERF_LVL_DISABLE_DS_LOG_USAGE'                   => 2, // disable delivery server log usage
    'MW_PERF_LVL_DISABLE_CUSTOMER_QUOTA_CHECK'           => 4, // disable customer quota check
    'MW_PERF_LVL_DISABLE_DS_QUOTA_CHECK'                 => 8, // disable delivery server quota check
    'MW_PERF_LVL_DISABLE_DS_CAN_SEND_TO_DOMAIN_OF_CHECK' => 16, // disable checking if can send to domain of the email address
    'MW_PERF_LVL_DISABLE_SUBSCRIBER_BLACKLIST_CHECK'     => 32, // disable checking emails against blacklist
);
So, if one doesn't want to log delivery servers sending and don't want to check customer quota (these two are expensive operations) could create a file called performance-levels-custom.php in apps/common/config and inside it define the MW_PERF_LVL constant as :
PHP:
if (!defined('MW_PERF_LVL')) {
    define('MW_PERF_LVL', MW_PERF_LVL_DISABLE_DS_LOG_USAGE | MW_PERF_LVL_DISABLE_CUSTOMER_QUOTA_CHECK);
}
 

Lakjin

Active Member
If it helps, i have just added some perfomance flags that one, depending on how he uses mailwizz, can use.
These are the flags:
PHP:
return array(
    'MW_PERF_LVL_DISABLE_DS_LOG_USAGE'                   => 2, // disable delivery server log usage
    'MW_PERF_LVL_DISABLE_CUSTOMER_QUOTA_CHECK'           => 4, // disable customer quota check
    'MW_PERF_LVL_DISABLE_DS_QUOTA_CHECK'                 => 8, // disable delivery server quota check
    'MW_PERF_LVL_DISABLE_DS_CAN_SEND_TO_DOMAIN_OF_CHECK' => 16, // disable checking if can send to domain of the email address
    'MW_PERF_LVL_DISABLE_SUBSCRIBER_BLACKLIST_CHECK'     => 32, // disable checking emails against blacklist
);
So, if one doesn't want to log delivery servers sending and don't want to check customer quota (these two are expensive operations) could create a file called performance-levels-custom.php in apps/common/config and inside it define the MW_PERF_LVL constant as :
PHP:
if (!defined('MW_PERF_LVL')) {
    define('MW_PERF_LVL', MW_PERF_LVL_DISABLE_DS_LOG_USAGE | MW_PERF_LVL_DISABLE_CUSTOMER_QUOTA_CHECK);
}

Just to confirm, the flags are already added to MailWizz and I just need to enable them by adding performance-levels-custom.php, right?
 

Lakjin

Active Member
I commented out lines 78 to 82 so that I could test this script before allowing it to make changes to tables (aside from the archive table) and it seems to have worked fine. Question. When I archive the logs, does that mean I will lose the stats I see when I look at the information for a campaign via the backend (the i button)?
 

twisted1919

Administrator
Staff member
@Lakjin - No, the stats should be there, mailwizz will read from both tables if you start archiving stuff, if i got your question right...
 

Lakjin

Active Member
Just to update: I went back and ran the original code (without commenting out lines) and everything worked beautifully -- your code seems to work fine. And now that I've shrunk this database email sending speed has drastically increased. Thanks!
 

Shahbaz Ali

New Member
@twisted1919 ArchiveCampaignsDeliveryLogs command working fine i have just transfer 10 million to archive table, but in version 1.3.6.1 MailWizz alter delivery log and archive tables, but didn't add support for new fields in ArchiveCampaignsDeliveryLogsCommand.php file. Please update to support new fields.
 
Top