CDR Mysql Maintenace limit retention

Morning all. I’m looking for a way to manage the number of records CDR Mysql stores.

For example I would like to retain only the last 12 months or 500mb.

Basicaly I want to make sure the CDR records don’t run me out of disk space.

Are there any managment features in asterisk to control this or am I going to have to write a script to run once a day to remove records older than 365 days old and put it in a cron job.

Any ideas are greatfuly recived

There is no housekeeping in Asterisk.

Do we agree that a scheduled task in mysql is the way to go on this?

CREATE EVENT cdr_limit
ON SCHEDULE EVERY 1 DAY
STARTS '2000-01-01 02:30:00’
DO DELETE FROM asteriskcdr.cdr WHERE calldate < NOW() - INTERVAL 366 DAY;

If I put this in a script and use cron to execute I may have to expose a user name and password in the script, plus another user may over write or delete my task in crontab by mistake.

That will proberly do it,
You concern over a user seeing the user/pass is correct, but if they can see you cron files then they will be able to see your asterisk files, so will know the password anyway.