Skip to content

Commit a8cee6e

Browse files
committed
chore: remove global retention fallback for workspace agent logs
Workspace agent logs retention is now explicit - it's enabled when --workspace-agent-logs-retention is set to a non-zero duration (default 7d), and disabled when set to 0. No fallback to global retention.
1 parent 9fcac9f commit a8cee6e

File tree

5 files changed

+14
-30
lines changed

5 files changed

+14
-30
lines changed

coderd/database/dbpurge/dbpurge.go

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

6969
workspaceAgentLogsRetention := vals.Retention.WorkspaceAgentLogs.Value()
70-
if workspaceAgentLogsRetention == 0 {
71-
workspaceAgentLogsRetention = vals.Retention.Global.Value()
72-
}
7370
if workspaceAgentLogsRetention > 0 {
7471
deleteOldWorkspaceAgentLogsBefore := start.Add(-workspaceAgentLogsRetention)
7572
if err := tx.DeleteOldWorkspaceAgentLogs(ctx, deleteOldWorkspaceAgentLogsBefore); err != nil {

coderd/database/dbpurge/dbpurge_test.go

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -423,15 +423,7 @@ func TestDeleteOldWorkspaceAgentLogsRetention(t *testing.T) {
423423
logsAge: 60 * 24 * time.Hour, // 60 days ago
424424
expectDeleted: false,
425425
},
426-
{
427-
name: "GlobalRetentionFallback",
428-
retentionConfig: codersdk.RetentionConfig{
429-
Global: serpent.Duration(14 * 24 * time.Hour), // 14 days global
430-
WorkspaceAgentLogs: serpent.Duration(0), // Not set, falls back to global
431-
},
432-
logsAge: 15 * 24 * time.Hour, // 15 days ago
433-
expectDeleted: true,
434-
},
426+
435427
{
436428
name: "CustomRetention30Days",
437429
retentionConfig: codersdk.RetentionConfig{

docs/admin/setup/data-retention.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ a YAML configuration file.
2626

2727
### Settings
2828

29-
| Setting | CLI Flag | Environment Variable | Default | Description |
30-
|----------------------|------------------------------------|----------------------------------------|----------------|------------------------------------------|
31-
| Audit Logs | `--audit-logs-retention` | `CODER_AUDIT_LOGS_RETENTION` | `0` (disabled) | How long to retain Audit Log entries |
32-
| Connection Logs | `--connection-logs-retention` | `CODER_CONNECTION_LOGS_RETENTION` | `0` (disabled) | How long to retain Connection Logs |
33-
| API Keys | `--api-keys-retention` | `CODER_API_KEYS_RETENTION` | `7d` | How long to retain expired API keys |
34-
| Workspace Agent Logs | `--workspace-agent-logs-retention` | `CODER_WORKSPACE_AGENT_LOGS_RETENTION` | `7d` | How long to retain workspace agent logs |
29+
| Setting | CLI Flag | Environment Variable | Default | Description |
30+
|----------------------|------------------------------------|----------------------------------------|----------------|-----------------------------------------|
31+
| Audit Logs | `--audit-logs-retention` | `CODER_AUDIT_LOGS_RETENTION` | `0` (disabled) | How long to retain Audit Log entries |
32+
| Connection Logs | `--connection-logs-retention` | `CODER_CONNECTION_LOGS_RETENTION` | `0` (disabled) | How long to retain Connection Logs |
33+
| API Keys | `--api-keys-retention` | `CODER_API_KEYS_RETENTION` | `7d` | How long to retain expired API keys |
34+
| Workspace Agent Logs | `--workspace-agent-logs-retention` | `CODER_WORKSPACE_AGENT_LOGS_RETENTION` | `7d` | How long to retain workspace agent logs |
3535

3636
### Duration Format
3737

@@ -183,4 +183,4 @@ containing the table name (e.g., `audit_logs`, `connection_logs`, `api_keys`).
183183
- [Audit Logs](../security/audit-logs.md): Learn about Audit Logs and manual
184184
purge procedures.
185185
- [Connection Logs](../monitoring/connection-logs.md): Learn about Connection
186-
Logs and monitoring.
186+
Logs and monitoring.

docs/reference/api/general.md

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/api/schemas.md

Lines changed: 6 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)