Skip to content

Commit 5a47352

Browse files
committed
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.
1 parent b56248e commit 5a47352

File tree

2 files changed

+0
-14
lines changed

2 files changed

+0
-14
lines changed

coderd/database/dbpurge/dbpurge.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,6 @@ func New(ctx context.Context, logger slog.Logger, db database.Store, vals *coder
130130

131131
var purgedAuditLogs int64
132132
auditLogsRetention := vals.Retention.AuditLogs.Value()
133-
if auditLogsRetention == 0 {
134-
auditLogsRetention = vals.Retention.Global.Value()
135-
}
136133
if auditLogsRetention > 0 {
137134
deleteAuditLogsBefore := start.Add(-auditLogsRetention)
138135
purgedAuditLogs, err = tx.DeleteOldAuditLogs(ctx, database.DeleteOldAuditLogsParams{

coderd/database/dbpurge/dbpurge_test.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,17 +1087,6 @@ func TestDeleteOldAuditLogs(t *testing.T) {
10871087
expectOldDeleted: false,
10881088
expectedLogsRemaining: 1, // old log is kept
10891089
},
1090-
{
1091-
name: "GlobalRetentionFallback",
1092-
retentionConfig: codersdk.RetentionConfig{
1093-
Global: serpent.Duration(retentionPeriod),
1094-
AuditLogs: serpent.Duration(0), // Not set, should fall back to global
1095-
},
1096-
oldLogTime: afterThreshold,
1097-
recentLogTime: &beforeThreshold,
1098-
expectOldDeleted: true,
1099-
expectedLogsRemaining: 1, // only recent log remains
1100-
},
11011090
}
11021091

11031092
for _, tc := range testCases {

0 commit comments

Comments
 (0)