feat(coderd): add retention policy configuration (#21021)

Add `RetentionConfig` with server flags for configuring data retention:

- `--audit-logs-retention`: retention for audit log entries
- `--connection-logs-retention`: retention for connection logs
- `--api-keys-retention`: retention for expired API keys (default 7d)

Updates #20743
This commit is contained in:
Mathias Fredriksson
2025-12-02 16:04:06 +02:00
committed by GitHub
parent 74d0c39cb3
commit 56e7858570
11 changed files with 314 additions and 0 deletions
+20
View File
@@ -14302,6 +14302,9 @@ const docTemplate = `{
"redirect_to_access_url": {
"type": "boolean"
},
"retention": {
"$ref": "#/definitions/codersdk.RetentionConfig"
},
"scim_api_key": {
"type": "string"
},
@@ -17728,6 +17731,23 @@ const docTemplate = `{
}
}
},
"codersdk.RetentionConfig": {
"type": "object",
"properties": {
"api_keys": {
"description": "APIKeys controls how long expired API keys are retained before being deleted.\nKeys are only deleted if they have been expired for at least this duration.\nDefaults to 7 days to preserve existing behavior.",
"type": "integer"
},
"audit_logs": {
"description": "AuditLogs controls how long audit log entries are retained.\nSet to 0 to disable (keep indefinitely).",
"type": "integer"
},
"connection_logs": {
"description": "ConnectionLogs controls how long connection log entries are retained.\nSet to 0 to disable (keep indefinitely).",
"type": "integer"
}
}
},
"codersdk.Role": {
"type": "object",
"properties": {
+20
View File
@@ -12886,6 +12886,9 @@
"redirect_to_access_url": {
"type": "boolean"
},
"retention": {
"$ref": "#/definitions/codersdk.RetentionConfig"
},
"scim_api_key": {
"type": "string"
},
@@ -16190,6 +16193,23 @@
}
}
},
"codersdk.RetentionConfig": {
"type": "object",
"properties": {
"api_keys": {
"description": "APIKeys controls how long expired API keys are retained before being deleted.\nKeys are only deleted if they have been expired for at least this duration.\nDefaults to 7 days to preserve existing behavior.",
"type": "integer"
},
"audit_logs": {
"description": "AuditLogs controls how long audit log entries are retained.\nSet to 0 to disable (keep indefinitely).",
"type": "integer"
},
"connection_logs": {
"description": "ConnectionLogs controls how long connection log entries are retained.\nSet to 0 to disable (keep indefinitely).",
"type": "integer"
}
}
},
"codersdk.Role": {
"type": "object",
"properties": {