-
Notifications
You must be signed in to change notification settings - Fork 928
chore!: delete old connection events from audit log #18735
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: ethan/fe-connection-log
Are you sure you want to change the base?
chore!: delete old connection events from audit log #18735
Conversation
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds a new cleanup step to remove old connection-related events from the audit_logs
table once they’re more than 90 days old, running in batches of 1000 every 10 minutes.
- Introduces a SQL query (
DeleteOldAuditLogConnectionEvents
) and corresponding Go method to delete old connection events. - Wires the deletion into the periodic
dbpurge
service, along with interface, mocks, metrics, and in-memory store updates. - Adds tests to verify deletion logic, limits, and authorization.
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
coderd/database/queries/auditlogs.sql | Define SQL delete to purge old connection events |
coderd/database/queries.sql.go | Add Go constant, params, and method for deletion |
coderd/database/querier.go | Extend interface with new deletion method |
coderd/database/dbpurge/dbpurge.go | Integrate the new deletion into the purge loop |
coderd/database/dbpurge/dbpurge_test.go | Add tests for deletion behavior and limits |
coderd/database/dbmock/dbmock.go | Mock the new deletion call in the mock store |
coderd/database/dbmetrics/querymetrics.go | Instrument deletion in metrics wrapper |
coderd/database/dbmem/dbmem.go | Implement fake deletion in in-memory querier |
coderd/database/dbauthz/dbauthz.go | Add authz check and proxy for the deletion call |
coderd/database/dbauthz/dbauthz_test.go | Add authorization test for the new delete method |
Comments suppressed due to low confidence (1)
coderd/database/dbpurge/dbpurge.go:22
- Update the comment to reference the correct table name (
audit_logs
) to match the actual table and avoid confusion.
// We'll slowly remove old connection events from the `audit_log` table,
5db1b73
to
4be35f4
Compare
da6d50a
to
0386f5b
Compare
4be35f4
to
9239251
Compare
0386f5b
to
ab296c6
Compare
This is the fifth PR for moving connection events out of the audit log.
In previous PRs:
connection_logs
table, in a previous PR. They will not appear in the audit log./api/v2/connectionlog
endpoint.In this PR:
The criteria for deletion is simple:
where
@before_time
is currently configured to 90 days in the past.If you require this data, we recommend querying it from the REST API or making a backup of the database/these events before upgrading.
There are currently no plans to delete connection events from the new
connection_logs
table.Future PRs: