Skip to main content
Question

Log Retention

  • February 18, 2025
  • 4 replies
  • 58 views

Forum|alt.badge.img+1

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?

 

4 replies

lpinsivy
Centreonian
Forum|alt.badge.img+21
  • Centreonian
  • March 19, 2025

Hi ​@HenryH can you try this patch https://github.com/centreon/centreon-archived/pull/11135?


Forum|alt.badge.img+1
  • Author
  • Steward *
  • March 19, 2025

Hi ​@Laurent,

 

I made the modification and it worked as expected. Do you plan to implement the change in the next releases?


lpinsivy
Centreonian
Forum|alt.badge.img+21
  • Centreonian
  • March 19, 2025

Thank you for the feedback, i’ll check with team how to prioritize this fix.


Forum|alt.badge.img+1
  • Author
  • Steward *
  • March 19, 2025

Thanks.

 

@mkanzler ​@THuerter FYI