Delete files older than x days – Linux


You can use find command to find and delete files older than the specified days. In this case 30.

find /backup/* -mtime +30 -exec rm {} \;

Non recursive example. The -prune option should limit find to only look for files in the /backup directory. So it won’t check any subdirectories.

find /backup/* -prune -mtime +30 -exec rm {} \; 

LibreNMS manually clean up MySQL Syslog Database

Adding the following option to the config.php file is supposed to delete anything over 30 days.

$config['syslog_purge']                                 = 30;

You can also manually delete the entries out of the MySQL database by logging into MySQL, selecting the librenms database, and running the command below.

The command deletes all entries older than 12/9/2018 at 08:00. Change the date and time as needed.

DELETE FROM syslog WHERE timestamp < '2018-12-9 08:00:00';

The following link has some more clean up options.
https://docs.librenms.org/Support/Cleanup-options/