Skip to main content

Data Retention

OpsiMate can automatically delete old data so the database does not grow without limit. Admins configure this in Settings → Data Retention.

Off by default​

Every retention policy starts disabled. Until you enable a policy, OpsiMate keeps everything and deletes nothing.

What gets purged​

Each policy deletes rows older than its window. The default windows are:

ResourceWhat it coversDefault window
Audit logsRecords of who changed what (providers, services, users, etc.)90 days
Alert history eventsPer-alert activity: ownership, silencings, actions run, comments90 days
Alert status historyFiring/resolved status transitions recorded for alerts90 days
Active alertsOpen alerts, aged by their last update — stale alerts that never resolve get cleaned while genuinely active ones are spared30 days
Resolved alertsResolved alerts kept for historical reference180 days
Alert commentsComments left on alerts by users365 days
Root cause analysesRoot causes pushed via the API or generated by the AI agent, with their ratings365 days
Enrichment versionsHistorical snapshots created whenever an enrichment rule changes365 days

For each resource you can change the number of days and enable or disable the policy independently.

Schedule​

The cleanup job runs when the configured interval has passed since the last run — every 24 hours by default (it also checks once at server startup). Admins can change the interval in Settings (1–720 hours); the last run time is shown next to it.

Only enabled policies run, and each run deletes only rows older than that policy's window.

Reclaiming disk space​

The Reclaim disk space after cleanup toggle (on by default) runs VACUUM after a cleanup that deleted rows, shrinking the SQLite database file. Without it, deleted rows free space inside the file for reuse but the file does not get smaller on disk.

Run a cleanup now​

Run cleanup now in Settings → Data Retention runs all enabled policies immediately, without waiting for the next scheduled run. OpsiMate reports how many rows were deleted and whether disk space was reclaimed.

API​

Retention is org-wide configuration, so every endpoint requires an admin token:

MethodEndpointPurpose
GET/api/v1/retentionCurrent config and all policies
PUT/api/v1/retention/configUpdate the cleanup interval and the VACUUM toggle
PUT/api/v1/retention/policies/:resourceTypeUpdate one policy's window or enabled state
POST/api/v1/retention/runRun a cleanup immediately