- Notifications
You must be signed in to change notification settings - Fork1.1k
feat: addconnectionlogs API#18628
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Conversation
ethanndickson commentedJun 27, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
| httpapi.Write(ctx,rw,http.StatusOK, codersdk.ConnectionLogResponse{ | ||
| ConnectionLogs:convertConnectionLogs(dblogs), | ||
| Count:0,// TODO(ethanndickson): Set count |
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.
This is populated in the next PR in the stack.
8cec6d1 to482a5d3Comparee4e1a04 to1fcd8d7Compare482a5d3 toccc7539CompareUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
ccc7539 to406e3f4CompareUh oh!
There was an error while loading.Please reload this page.
88bf416 tocd30512Comparecd30512 to3a8822dCompareUh oh!
There was an error while loading.Please reload this page.
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
1fcd8d7 tof47a3f7Compare3a8822d to02a93e0Comparef47a3f7 to0346609Compare02a93e0 to2231707CompareThere 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
Introduces the new ConnectionLogs API to mirror audit log functionality for connection events, including server routing, handler logic, DB queries, client SDK support, tests, and docs.
- Adds
/api/v2/connectionlogendpoint and pagination/filtering logic on the server - Implements search parser, SQL filters, and Go SDK client method
- Updates TypeScript types, autogenerated docs, enterprise tests, and pagination helpers
Reviewed Changes
Copilot reviewed 25 out of 25 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
enterprise/coderd/connectionlog.go | New handler, routing, and conversion logic |
coderd/searchquery/search.go | AddedConnectionLogs query parser |
coderd/database/queries/connectionlogs.sql | New SQL filters for connection log queries |
codersdk/connectionlog.go | Client method and types for ConnectionLogs |
site/src/api/typesGenerated.ts | TS interfaces for new API types |
Multipleenterprise/coderd/*_test.go files | Tests for parsing, DB querier, and handler |
coderd/pagination.go | Renamed and updated pagination helper |
docs/reference/api/* and Swagger JSON files | Documentation for new endpoint and schemas |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
0346609 to72ebddbCompare2231707 to133e51dCompare72ebddb to7d13236Compare133e51d tob8faf73Compare7d13236 tobea35a3Compareb8faf73 to3ec1f06Comparebea35a3 to3164ea2Compare3ec1f06 toc013e9fCompareethanndickson commentedJul 15, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Merge activity
|
c013e9f toafdb48dCompare7a339a1 intomainUh oh!
There was an error while loading.Please reload this page.

Uh oh!
There was an error while loading.Please reload this page.
This is the second PR for moving connection events out of the audit log.
This PR:
/api/v2/connectionlogendpointGetAuthorizedConnectionLogsOffsetand thus the endpoint.There's quite a few, but I was aiming for feature parity with the audit log.
organization:<id|name>workspace_owner:<username>workspace_owner_email:<email>type:<ssh|vscode|jetbrains|reconnecting_pty|workspace_app|port_forwarding>username:<username>user_email:<email>connected_after:<time>connected_before:<time>workspace_id:<id>connection_id:<id>status:<connected|disconnected>connectedonly sessions with a nullclose_timeare returned, ifdisconnected, only those with a non-nullclose_time. If filter is omitted, both are returned.Future PRs:
countonConnectionLogResponseusing a seperate query (to preemptively mitigate the issue described inAudit log slows to a crawl when nearing 1 million entries #17689)