Automatic purge of alarm log indices#2930
Conversation
|
Ah, Instead of using a different temporal system ( days ) we could use the same system we have for creating new indices. |
|
@shroffk, I actually considered using If you insist I can switch back ;-) |
|
@shroffk, the alarm logger is a Spring Boot application, but does not take full advantage of the framework. For instance, the Elasticsearch client is not exposed as a bean, which would be desirable to facilitate unit testing. Any reason to not update the service to be more aligned with the common practices in Spring Boot? |
|
@shroffk, updated as requested. |
Triggered by issues with "overflow" of Elasticsearch alarm log indices, I've added a Spring Component that may purge indices automatically at regular intervals.
By default the Component is not even instantiated, i.e. automatic purge is disabled. To enable, the service must be started by setting
retention_period_daysto a value larger or equal to 100. This number also defines the purge policy, e.g. only indices where last inserted message time isnow - retention_period_daysare considered. The lower limit of 100 days is there to avoid accidental removal of non-obsolete/active indices.A cron expression is used to determine when to run the purge process, default is midnight every Sunday.