LibreNMS syslog.ibd cleanup

Recently I ran into an issue where a librenms install was taking up a crazy amount of disk space. This was tracked down to the syslog.ibd file . Even thought I had set my options to be less than 10 days per this link https://docs.librenms.org/Support/Cleanup-options/ I still was having a huge file.

Here is what I did to fix it. My root partition was too full to start MariaDB. I went into var and cleaned out enough log files to make space to start MariaDB. The following are tee commands I ran on CentOS 7 to fix it.

mysql -u username -p

Once at an MYSQL prompt after logging in I issued the following command to verify I could see my librenms database.

show databases;

The I issued

use dbname;

In may case it was “librenms”. Once connected to the database I ran the following command

DELETE FROM syslog WHERE timestamp < '2021-1-28 08:00:00';

This commands removes all syslog entries from the database before the date and time specified. In my case this was close to 40 GIG.

After I restarted MariaDB, ran .daily.sh and all was good.