From d252ed321a17a0861056646a7621e3aed0d1ada9 Mon Sep 17 00:00:00 2001 From: Martin Porwoll Date: Sun, 15 Feb 2026 00:33:43 +0000 Subject: [PATCH] feat(monitoring): add retention policies for monitoring collections Co-Authored-By: Claude Opus 4.6 --- src/lib/retention/retention-config.ts | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/lib/retention/retention-config.ts b/src/lib/retention/retention-config.ts index e7472d1..6ad6739 100644 --- a/src/lib/retention/retention-config.ts +++ b/src/lib/retention/retention-config.ts @@ -50,6 +50,31 @@ export const retentionPolicies: RetentionPolicy[] = [ batchSize: 50, description: 'Consent-Logs nach Ablaufdatum löschen (DSGVO: 3 Jahre)', }, + // Monitoring Collections + { + name: 'monitoring-snapshots', + collection: 'monitoring-snapshots', + retentionDays: parseInt(process.env.RETENTION_MONITORING_SNAPSHOTS_DAYS || '7', 10), + dateField: 'createdAt', + batchSize: 500, + description: 'Monitoring-Snapshots älter als X Tage löschen', + }, + { + name: 'monitoring-alert-history', + collection: 'monitoring-alert-history', + retentionDays: parseInt(process.env.RETENTION_MONITORING_ALERTS_DAYS || '90', 10), + dateField: 'createdAt', + batchSize: 100, + description: 'Alert-History älter als X Tage löschen', + }, + { + name: 'monitoring-logs', + collection: 'monitoring-logs', + retentionDays: parseInt(process.env.RETENTION_MONITORING_LOGS_DAYS || '30', 10), + dateField: 'createdAt', + batchSize: 200, + description: 'Monitoring-Logs älter als X Tage löschen', + }, ] /**