Deletion of Delivery Servers Usage Logs and Campaigns Delivery Logs

rags810

Member
When the customer is deleting the campaign, the logs are not being deleted of Delivery Servers Usage Logs and Campaigns Delivery Logs. I am using 1.3.7.2 version.

Why is it not being deleted when we delete campaign? There are more than 1.3 million records in Delivery Servers Usage Logs.

So how to delete all old logs where the campaigns have been deleted already?
 

twisted1919

Administrator
Staff member
Hi,

The Campaigns Delivery Logs are deleted once a campaign gets deleted, but keep in mind a campaign gets deleted for real at midnight, by the daily cron job.
As for the Delivery Servers Usage logs, logs older than 6 months are removed automatically each day.
If you need to delete more of them, you can do it manually from a mysql command prompt.

Thanks.
 

rags810

Member
Thanks for the quick reply. But If I delete manually using mysql command everyday of all the logs, are these logs related to customer reports or its only for admin purpose? I just dont want those logs piling up so much in the database.

By the way, I updated from 1.3.5.8 to 1.3.7.8, now all mails are in pending-sending. I read most of forum posts, and followed all the recommendations, but still showing pending-sending. Unable to understand the issue? Is there anything I need to setup after updating to 1.3.7.8?

Thanks so much and appreciate your latest updates.
 

twisted1919

Administrator
Staff member
The idea is to delete only logs that are few months older.
Actually, you know what, open /apps/console/commands/DailyCommand.php and look for:
PHP:
protected function deleteDeliveryServersUsageLogs()
{
    try {
        $connection = Yii::app()->getDb();
        $connection->createCommand('DELETE FROM `{{delivery_server_usage_log}}` WHERE date_added < DATE_SUB(NOW(), INTERVAL 1 YEAR)')->execute();    
    } catch (Exception $e) {
        Yii::log($e->getMessage(), CLogger::LEVEL_ERROR);
    }
    return $this;
}

and make it
PHP:
protected function deleteDeliveryServersUsageLogs()
{
    try {
        $connection = Yii::app()->getDb();
        $connection->createCommand('DELETE FROM `{{delivery_server_usage_log}}` WHERE date_added < DATE_SUB(NOW(), INTERVAL 3 MONTH)')->execute();    
    } catch (Exception $e) {
        Yii::log($e->getMessage(), CLogger::LEVEL_ERROR);
    }
    return $this;
}
That way you delete logs older than 3 months, automatically, each day. I also adjsuted the core app to do like so, so the change is safe for updates.

By the way, I updated from 1.3.5.8 to 1.3.7.8, now all mails are in pending-sending. I read most of forum posts, and followed all the recommendations, but still showing pending-sending. Unable to understand the issue? Is there anything I need to setup after updating to 1.3.7.8?
It's the cron jobs more than sure, see https://kb.mailwizz.com/articles/my-campaigns-dont-send-theyre-stuck-in-pending-sending-status/ and https://kb.mailwizz.com/articles/debug-send-campaigns-command/
 

rags810

Member
Yes, I did. Still no output. Where can I get to see debugging log? (but nothing in application log)

Edit: By the way, I disabled the firewall and tested too. Still no good. I have also contacted my host and awaiting for their answer if any issues on server.
 

twisted1919

Administrator
Staff member
When you run in verbose mode and with debug enabled you have to see something in the output, even if the app does nothing:
Code:
-bash-4.2$ php apps/console/console.php send-campaigns --verbose=1
[2016-11-24 15:39:14] - Loading 5 campaigns, starting with offset 0...
[2016-11-24 15:39:14] - No campaign found, stopping.
-bash-4.2$
 

rags810

Member
When you run in verbose mode and with debug enabled you have to see something in the output, even if the app does nothing:
Code:
-bash-4.2$ php apps/console/console.php send-campaigns --verbose=1
[2016-11-24 15:39:14] - Loading 5 campaigns, starting with offset 0...
[2016-11-24 15:39:14] - No campaign found, stopping.
-bash-4.2$

in the application log or in the shell terminal?
 

rags810

Member
Okay, finally now, started working. I killed that process and started getting cron mails as per your debug thing.

Code:
[2016-11-24 15:39:01] - Loading 5 campaigns, starting with offset 0...
[2016-11-24 15:39:01] - Found 5 campaigns and now starting processing them...
[2016-11-24 15:39:01] - Campaign Worker #0 looking into the campaign with ID: 922
[2016-11-24 15:39:01] - This campaign belongs to Indian Medical Association IMA(uid: zd160ac86eac5).
[2016-11-24 15:39:01] - Changing the campaign status into PROCESSING!
[2016-11-24 15:39:01] - Looking for subscribers for campaign with uid ar912yp7d887d...(This is subscribers worker #0)
[2016-11-24 15:39:01] - This subscribers worker(#0) will process 53 subscribers for this campaign...
[2016-11-24 15:39:01] - Running subscribers cleanup...
[2016-11-24 15:39:01] - Checking subscribers count after cleanup: 53
[2016-11-24 15:39:01] - Sorting the subscribers...
[2016-11-24 15:39:01] - Entering the foreach processing loop for all 53 subscribers...

Thank you so much for all your help.
 

rags810

Member
Same issue occurred again. I had to kill the process and run the SSH command then its started sending the emails. But cron executes the script and script does nothing. I have to kill the process and when I run it through SSH then it works. I can't understand the issue.

I seriously doubt of a bug or may not be updated to the latest version correctly.
 

twisted1919

Administrator
Staff member
What to run with wget? The send-campaigns command ? That's not doable, that works from command line only.
 
Top