mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: add retention config for workspace_agent_logs (#21039)
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
This commit is contained in:
@@ -829,6 +829,11 @@ type RetentionConfig struct {
|
||||
// Keys are only deleted if they have been expired for at least this duration.
|
||||
// Defaults to 7 days to preserve existing behavior.
|
||||
APIKeys serpent.Duration `json:"api_keys" typescript:",notnull"`
|
||||
// WorkspaceAgentLogs controls how long workspace agent logs are retained.
|
||||
// Logs are deleted if the agent hasn't connected within this period.
|
||||
// Logs from the latest build are always retained regardless of age.
|
||||
// Defaults to 7 days to preserve existing behavior.
|
||||
WorkspaceAgentLogs serpent.Duration `json:"workspace_agent_logs" typescript:",notnull"`
|
||||
}
|
||||
|
||||
type NotificationsConfig struct {
|
||||
@@ -3420,6 +3425,17 @@ Write out the current server config as YAML to stdout.`,
|
||||
YAML: "api_keys",
|
||||
Annotations: serpent.Annotations{}.Mark(annotationFormatDuration, "true"),
|
||||
},
|
||||
{
|
||||
Name: "Workspace Agent Logs Retention",
|
||||
Description: "How long workspace agent logs are retained. Logs from non-latest builds are deleted if the agent hasn't connected within this period. Logs from the latest build are always retained. Set to 0 to disable automatic deletion.",
|
||||
Flag: "workspace-agent-logs-retention",
|
||||
Env: "CODER_WORKSPACE_AGENT_LOGS_RETENTION",
|
||||
Value: &c.Retention.WorkspaceAgentLogs,
|
||||
Default: "7d",
|
||||
Group: &deploymentGroupRetention,
|
||||
YAML: "workspace_agent_logs",
|
||||
Annotations: serpent.Annotations{}.Mark(annotationFormatDuration, "true"),
|
||||
},
|
||||
{
|
||||
Name: "Enable Authorization Recordings",
|
||||
Description: "All api requests will have a header including all authorization calls made during the request. " +
|
||||
|
||||
Reference in New Issue
Block a user