Hello,
using the Log Retention with a value 365 or even 31 the Cronjob /usr/share/centreon/cron/centstorage_purge.php doesn’t clean (all) old comments.
I’ve got comments from 2017.
Responsible SQL Query to cleanup:
DELETE FROM comments WHERE (deletion_time is not null and deletion_time ' .
'< __RETENTION__) OR (expire_time < __RETENTION__ AND expire_time <> 0)
Value for __RETENTION__ is the value from the config, in my case 365. The table field expire_time is always 0, so the second part of the query is never matching.
The field deletion_time is on many entrys NULL (currently 100174 entrys) and on 3287090 entrys not null.
I’m not sure about the fields deletion_time and expire_time what are they for. But comments from 2017 shouldn’t be there in Year 2025 with retention period of 365 days.
Manually checking the filter:
SELECT * FROM centreon_storage.comments WHERE (deletion_time is not null and deletion_time < 1708297200 ) OR (expire_time < 1708297200 AND expire_time <> 0)
Returns 0 results.
SELECT COUNT(*) FROM centreon_storage.comments WHERE entry_time < 1708297200
Returns 89889.
There are also 89889 comments older then retention.
Should i build my own clean job filtering on entry_time? What are the deletion_time and expire_time for?