My server is currently backing up a 2GB CDR database with about 4yrs of data, I would like to delete 2013 and older
Before I do anything, I would like to check that the below is still the safest way to clear out the CDR table
SSH to the server.
DELETE from cdr WHERE calldate < ‘2014-01-01 00:00:00’;
The above should delete anything older than the 1st Jan 2014?
I am running 2.11 - Asterisk 11 64-bit
I have looked at this and have run the above command. It only took the database down about 200mb
On looking further it’s the CEL table within asteriskcdrdb that’s huge with almost 9 million rows!!
Could I run the following to sync it down to the same date range as the first post?
DELETE from cel WHERE eventtime < ‘2014-01-01 00:00:00’;
yes you can;
And also if you want to downsize your cel table my formula is;
DELETE from cel WHERE context=‘tc-maint’;
*** Please, take backup before trying this.
Works a treat however with CEL logging disabled it’s still logging to the table. I’ve had to create a shell script to empty it every night.
My database is now down to 98mb, a HUGE difference!