Delete MYSQL Entries Older Than Two Weeks
I have an old cacti install plugging away that chokes on the number of syslog entries if I let them stack up longer than two weeks, so here’s a simple cron job I scheduled that runs nightly deleting everything older than 2 weeks:
1 | mysql -e 'delete from syslog where date < current_date() - interval 14 day;' syslog |
The command instructs mysql to run from the CLI using database syslog. It takes the current date and subtracts 14 days…pretty simple.
Good luck and happy querying.