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:
| Resource | What it covers | Default window |
|---|---|---|
| Audit logs | Records of who changed what (providers, services, users, etc.) | 90 days |
| Alert history events | Per-alert activity: ownership, silencings, actions run, comments | 90 days |
| Alert status history | Firing/resolved status transitions recorded for alerts | 90 days |
| Active alerts | Open alerts, aged by their last update — stale alerts that never resolve get cleaned while genuinely active ones are spared | 30 days |
| Resolved alerts | Resolved alerts kept for historical reference | 180 days |
| Alert comments | Comments left on alerts by users | 365 days |
| Root cause analyses | Root causes pushed via the API or generated by the AI agent, with their ratings | 365 days |
| Enrichment versions | Historical snapshots created whenever an enrichment rule changes | 365 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:
| Method | Endpoint | Purpose |
|---|---|---|
GET | /api/v1/retention | Current config and all policies |
PUT | /api/v1/retention/config | Update the cleanup interval and the VACUUM toggle |
PUT | /api/v1/retention/policies/:resourceType | Update one policy's window or enabled state |
POST | /api/v1/retention/run | Run a cleanup immediately |