[➕ Feature]: Time-based automatic alert deletion (retention policy)
Is your feature request related to a problem? Please describe. Support automatic deletion of alerts based on age and status. Currently, alerts remain in the database indefinitely unless removed manually. It would be useful to define retention policies — for example:
- Delete
resolvedalerts after 7 days - Keep
firingalerts for up to 30 days
Describe the solution you'd like Allow configuring per-status retention policies (via config or UI). For example:
- "Resolved alerts older than X days → auto-delete"
- "Firing alerts older than Y days → retain"
- Apply defaults if no config is given
Additional context Useful in high-velocity environments to prevent unbounded alert growth. Could also help reduce DB size and improve system performance over time.
@shahargl We're looking for this feature as well, as we have high velocity of alerts. We were looking for archival of issues based on suppressed or resolved, where archival would mean, moving these alerts to some other tables which can improve performance, and eventually delete them after an interval. Archival and deletion would be configurable per status.
Would it be possible to prioritize this?
Hey @CaptISS - its a great to have you here.
If you want I can help you implement it. We already have something which one of our users did - see this https://github.com/keephq/helm-charts/blob/53d2e485674e44de888b6d0141019004938883fe/charts/keep/templates/db-cleanup-cronjob.yaml#L32
We also have a discussion for that on our Slack - https://getkeep.slack.com/archives/C04PT44MATS/p1751282114101109
You are more than welcome to participate.
I can see the job named 'mysql-cleanup', but not 'postgresql-cleanup'. Does that mean that if I want to clean up, I should only use the MySQL database? I don't want to archive alerts for years and cleaning up is an important future task.