Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2a5d86e

Browse files
authored
docs: add vacuum full onaudit logs table recommendation (#20608)
1 parenteef1842 commit2a5d86e

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

‎docs/admin/security/audit-logs.md‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,36 @@ Should you wish to purge these records, it is safe to do so. This can only be do
151151
directly against the`audit_logs` table in the database. We advise users to only purge old records (>1yr)
152152
and in accordance with your compliance requirements.
153153

154+
###Maintenance Procedures for the Audit Logs Table
155+
156+
>[!NOTE]
157+
>`VACUUM FULL` acquires an exclusive lock on the table, blocking all reads and writes. For more information, see the[PostgreSQL VACUUM documentation](https://www.postgresql.org/docs/current/sql-vacuum.html).
158+
159+
You may choose to run a`VACUUM` or`VACUUM FULL` operation on the audit logs table to reclaim disk space. If you choose to run the`FULL` operation, consider the following when doing so:
160+
161+
-**Run during a planned mainteance window** to ensure ample time for the operation to complete and minimize impact to users
162+
-**Stop all running instances of`coderd`** to prevent connection errors while the table is locked. The actual steps for this will depend on your particular deployment setup. For example, if your`coderd` deployment is running on Kubernetes:
163+
164+
```bash
165+
kubectl scale deployment coder --replicas=0 -n coder
166+
```
167+
168+
-**Terminate lingering connections** before running the`VACUUM` operation to ensure it starts immediately
169+
170+
```sql
171+
SELECT pg_terminate_backend(pg_stat_activity.pid)
172+
FROM pg_stat_activity
173+
WHEREpg_stat_activity.datname='coder'AND pid<> pg_backend_pid();
174+
```
175+
176+
-**Only`coderd` needs to scale down** - external provisioner daemons, workspace proxies, and workspace agents don't connect to the database directly.
177+
178+
After the vacuum completes, scale coderd back up:
179+
180+
```bash
181+
kubectl scale deployment coder --replicas= -n coder
182+
```
183+
154184
###Backup/Archive
155185

156186
Consider exporting or archiving these records before deletion:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp