Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: remove global retention fallback for audit logs
Audit logs retention is now explicit - it's enabled when
--audit-logs-retention is set to a non-zero duration, and
disabled when set to 0. No fallback to global retention.
  • Loading branch information
mafredri committed Dec 2, 2025
commit a30940e429484cdda3aaf77e09ab1b62a2359e80
3 changes: 0 additions & 3 deletions coderd/database/dbpurge/dbpurge.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,6 @@ func New(ctx context.Context, logger slog.Logger, db database.Store, vals *coder

var purgedAuditLogs int64
auditLogsRetention := vals.Retention.AuditLogs.Value()
if auditLogsRetention == 0 {
auditLogsRetention = vals.Retention.Global.Value()
}
if auditLogsRetention > 0 {
deleteAuditLogsBefore := start.Add(-auditLogsRetention)
purgedAuditLogs, err = tx.DeleteOldAuditLogs(ctx, database.DeleteOldAuditLogsParams{
Expand Down
11 changes: 0 additions & 11 deletions coderd/database/dbpurge/dbpurge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1087,17 +1087,6 @@ func TestDeleteOldAuditLogs(t *testing.T) {
expectOldDeleted: false,
expectedLogsRemaining: 1, // old log is kept
},
{
name: "GlobalRetentionFallback",
retentionConfig: codersdk.RetentionConfig{
Global: serpent.Duration(retentionPeriod),
AuditLogs: serpent.Duration(0), // Not set, should fall back to global
},
oldLogTime: afterThreshold,
recentLogTime: &beforeThreshold,
expectOldDeleted: true,
expectedLogsRemaining: 1, // only recent log remains
},
}

for _, tc := range testCases {
Expand Down