@@ -25,12 +25,11 @@ a YAML configuration file.
2525
2626### Settings
2727
28- | Setting | CLI Flag | Environment Variable | Default | Description |
29- | -----------------| -------------------------------| -----------------------------------| ------------------| --------------------------------------------------------------------------|
30- | Global | ` --global-retention ` | ` CODER_GLOBAL_RETENTION ` | ` 0 ` (disabled) | Default retention for all data types. Individual settings override this. |
31- | Audit Logs | ` --audit-logs-retention ` | ` CODER_AUDIT_LOGS_RETENTION ` | ` 0 ` (use global) | How long to retain Audit Log entries. |
32- | Connection Logs | ` --connection-logs-retention ` | ` CODER_CONNECTION_LOGS_RETENTION ` | ` 0 ` (use global) | How long to retain Connection Log entries. |
33- | API Keys | ` --api-keys-retention ` | ` CODER_API_KEYS_RETENTION ` | ` 7d ` | How long to retain expired API keys. |
28+ | Setting | CLI Flag | Environment Variable | Default | Description |
29+ | -----------------| -------------------------------| -----------------------------------| ----------------| --------------------------------------|
30+ | Audit Logs | ` --audit-logs-retention ` | ` CODER_AUDIT_LOGS_RETENTION ` | ` 0 ` (disabled) | How long to retain Audit Log entries |
31+ | Connection Logs | ` --connection-logs-retention ` | ` CODER_CONNECTION_LOGS_RETENTION ` | ` 0 ` (disabled) | How long to retain Connection Logs |
32+ | API Keys | ` --api-keys-retention ` | ` CODER_API_KEYS_RETENTION ` | ` 7d ` | How long to retain expired API keys |
3433
3534### Duration Format
3635
@@ -47,26 +46,25 @@ Go duration units (`h`, `m`, `s`):
4746
4847``` bash
4948coder server \
50- --global-retention=90d \
5149 --audit-logs-retention=365d \
50+ --connection-logs-retention=90d \
5251 --api-keys-retention=7d
5352```
5453
5554### Environment Variables Example
5655
5756``` bash
58- export CODER_GLOBAL_RETENTION=90d
5957export CODER_AUDIT_LOGS_RETENTION=365d
58+ export CODER_CONNECTION_LOGS_RETENTION=90d
6059export CODER_API_KEYS_RETENTION=7d
6160```
6261
6362### YAML Configuration Example
6463
6564``` yaml
6665retention :
67- global : 90d
6866 audit_logs : 365d
69- connection_logs : 0s
67+ connection_logs : 90d
7068 api_keys : 7d
7169` ` `
7270
@@ -84,11 +82,10 @@ purge process:
8482
8583### Effective Retention
8684
87- For each data type, the effective retention is determined as follows :
85+ Each retention setting controls its data type independently :
8886
89- 1. If the individual setting is non-zero, use that value.
90- 2. If the individual setting is zero, use the global retention value.
91- 3. If both are zero, retention is disabled (data is kept indefinitely).
87+ - When set to a non-zero duration, records older than that duration are deleted.
88+ - When set to ` 0`, retention is disabled and data is kept indefinitely.
9289
9390# ## API Keys Special Behavior
9491
@@ -111,9 +108,8 @@ For most deployments, we recommend:
111108
112109` ` ` yaml
113110retention:
114- global: 90d
115111 audit_logs: 365d
116- connection_logs: 0s # Use global
112+ connection_logs: 90d
117113 api_keys: 7d
118114` ` `
119115
@@ -150,22 +146,15 @@ for guidance.
150146
151147# # Keeping Data Indefinitely
152148
153- Setting a retention value to `0` means "use global retention", not "disable".
154- To disable all automatic purging, set global to `0` and leave individual
155- settings at `0` :
149+ To keep data indefinitely for any data type, set its retention value to `0` :
156150
157151` ` ` yaml
158152retention:
159- global: 0s
160- audit_logs: 0s
161- connection_logs: 0s
162- api_keys: 0s
153+ audit_logs: 0s # Keep audit logs forever
154+ connection_logs: 0s # Keep connection logs forever
155+ api_keys: 0s # Keep expired API keys forever
163156` ` `
164157
165- There is no way to disable retention for a specific data type while global
166- retention is enabled. If you need to retain one data type longer than others,
167- set its individual retention to a larger value.
168-
169158# # Monitoring
170159
171160The purge process logs deletion counts at the `DEBUG` level. To monitor
@@ -177,4 +166,4 @@ containing the table name (e.g., `audit_logs`, `connection_logs`, `api_keys`).
177166- [Audit Logs](../security/audit-logs.md) : Learn about Audit Logs and manual
178167 purge procedures.
179168- [Connection Logs](../monitoring/connection-logs.md) : Learn about Connection
180- Logs and monitoring.
169+ Logs and monitoring.
0 commit comments