Skip to content

Conversation

@mafredri
Copy link
Member

@mafredri mafredri commented Dec 1, 2025

Replace hardcoded 7-day retention for workspace agent logs with configurable
retention from deployment settings. Defaults to 7d to preserve existing behavior.

Depends on #21038
Updates #20743


PR Stack

PR Title
#21021 feat(coderd): add retention policy configuration
#21022 feat(coderd/database/dbpurge): add retention for connection logs
#21025 feat(coderd/database/dbpurge): add retention for audit logs
#21037 feat(coderd/database/dbpurge): make API keys retention configurable
#21038 docs: add data retention documentation
👉 #21039 feat: add retention config for workspace_agent_logs

@mafredri mafredri force-pushed the mafredri/feat-coderd-db-retention-policy-6 branch from 80049c4 to 9b7c3b4 Compare December 1, 2025 17:24
@mafredri mafredri changed the title feat(coderd): add workspace_agent_logs retention configuration feat(coderd/database/dbpurge): make workspace agent logs retention configurable Dec 1, 2025
@mafredri mafredri force-pushed the mafredri/feat-coderd-db-retention-policy-6 branch 5 times, most recently from db839b6 to 95e8a6c Compare December 1, 2025 17:39
@mafredri mafredri changed the title feat(coderd/database/dbpurge): make workspace agent logs retention configurable feat(coderd/database/dbpurge): add retention config for workspace_agent_logs Dec 1, 2025
@mafredri mafredri force-pushed the mafredri/feat-coderd-db-retention-policy-6 branch 2 times, most recently from bf5595f to 8ef92f7 Compare December 1, 2025 17:51
@mafredri mafredri changed the title feat(coderd/database/dbpurge): add retention config for workspace_agent_logs feat: add retention config for workspace_agent_logs Dec 1, 2025
@mafredri mafredri force-pushed the mafredri/feat-coderd-db-retention-policy-6 branch from 8ef92f7 to ee8e8de Compare December 1, 2025 18:03
@mafredri mafredri force-pushed the mafredri/feat-coderd-db-retention-policy-5 branch from 7e8a005 to b1ce17f Compare December 2, 2025 10:08
@mafredri mafredri force-pushed the mafredri/feat-coderd-db-retention-policy-6 branch from ee8e8de to 1c25487 Compare December 2, 2025 10:16
@mafredri mafredri force-pushed the mafredri/feat-coderd-db-retention-policy-5 branch from b1ce17f to d058883 Compare December 2, 2025 10:17
@mafredri mafredri force-pushed the mafredri/feat-coderd-db-retention-policy-6 branch 2 times, most recently from bec5b55 to a8cee6e Compare December 2, 2025 10:32
@mafredri mafredri force-pushed the mafredri/feat-coderd-db-retention-policy-6 branch 2 times, most recently from 955dc9c to 9ccd75d Compare December 2, 2025 10:59
Copy link
Member

@mtojek mtojek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good 👍

@mafredri mafredri force-pushed the mafredri/feat-coderd-db-retention-policy-6 branch from 9ccd75d to 54cf5f0 Compare December 2, 2025 11:11
@mafredri mafredri force-pushed the mafredri/feat-coderd-db-retention-policy-5 branch from d058883 to 267c7d8 Compare December 2, 2025 11:13
@mafredri mafredri force-pushed the mafredri/feat-coderd-db-retention-policy-6 branch from 54cf5f0 to fe71946 Compare December 2, 2025 11:14
@mafredri mafredri force-pushed the mafredri/feat-coderd-db-retention-policy-5 branch from 267c7d8 to 8843bb3 Compare December 2, 2025 11:37
@mafredri mafredri force-pushed the mafredri/feat-coderd-db-retention-policy-6 branch from fe71946 to a1bd345 Compare December 2, 2025 11:37
@mafredri mafredri force-pushed the mafredri/feat-coderd-db-retention-policy-5 branch from 8843bb3 to b15783b Compare December 2, 2025 12:56
@mafredri mafredri force-pushed the mafredri/feat-coderd-db-retention-policy-6 branch 2 times, most recently from abc9827 to d51c53d Compare December 2, 2025 13:27
@mafredri mafredri added the doc-check Assign this label to PRs to check for any doc changes. label Dec 2, 2025
@github-actions
Copy link

github-actions bot commented Dec 2, 2025

Copy link
Member Author

mafredri commented Dec 2, 2025

📚 Documentation Check

✨ No Changes Needed

The documentation for workspace agent logs retention has already been comprehensively updated in this PR. The changes include:

  • docs/admin/setup/data-retention.md - Already documents workspace agent logs retention with:
    • Configuration settings (line 34)
    • CLI examples (line 54)
    • Environment variable examples (line 63)
    • YAML configuration examples (line 73)
    • Detailed behavior explanation (lines 108-117) including the important note that logs from the latest build are always retained

The documentation accurately explains the feature's behavior and configuration options.


This comment was generated by an AI Agent through Coder Tasks

@mafredri mafredri force-pushed the mafredri/feat-coderd-db-retention-policy-5 branch from b15783b to 3caa0ab Compare December 2, 2025 14:52
@mafredri mafredri force-pushed the mafredri/feat-coderd-db-retention-policy-6 branch from d51c53d to 58a76db Compare December 2, 2025 14:53
@mafredri mafredri force-pushed the mafredri/feat-coderd-db-retention-policy-5 branch from 3caa0ab to f8cefc6 Compare December 2, 2025 15:42
Base automatically changed from mafredri/feat-coderd-db-retention-policy-5 to main December 2, 2025 15:47
Replace hardcoded 7-day retention for workspace agent logs with configurable
retention from deployment settings. Falls back to global retention when not
set, and skips deletion entirely when effective retention is 0.

Depends on #21038
Updates #20743
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.
…tion

The description was misleading by stating logs are deleted 'after this
period' without explaining that retention is based on when the agent
last connected, not the age of the logs themselves. Updated to clearly
state that logs from non-latest builds are deleted if the agent hasn't
connected within the retention period, and that logs from the latest
build are always retained.
@mafredri mafredri force-pushed the mafredri/feat-coderd-db-retention-policy-6 branch from 58a76db to 6bea198 Compare December 2, 2025 15:52
@mafredri mafredri enabled auto-merge (squash) December 2, 2025 15:52
@mafredri mafredri merged commit ff46917 into main Dec 2, 2025
35 checks passed
@mafredri mafredri deleted the mafredri/feat-coderd-db-retention-policy-6 branch December 2, 2025 16:01
@github-actions github-actions bot locked and limited conversation to collaborators Dec 2, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

doc-check Assign this label to PRs to check for any doc changes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants