Add stable GetAuditLog API with stable cursor pagination#11321
Merged
Add stable GetAuditLog API with stable cursor pagination#11321
Conversation
Contributor
Author
|
Edit: my AI posted a slop comment 😮💨 Gona fix it |
4d2ebef to
2230efa
Compare
Contributor
Author
|
Ok I updated the doc a little bit to recommend the key type required for this api/rpc. PTAL |
vadimberezniker
approved these changes
Feb 27, 2026
2230efa to
ef9f616
Compare
bduffany
approved these changes
Mar 2, 2026
e0f839e to
8236475
Compare
Contributor
Author
|
Codex review caught an issue where end_time is also needed in auditLogPageToken to ensure the edge entries don't jump from one page to another in extreme cases. So I added that as a separate commit for easier review. Then we need a Part 2 to add parent-child support. |
bduffany
reviewed
Mar 17, 2026
vadimberezniker
approved these changes
Mar 17, 2026
Add api.v1 GetAuditLog RPC, schema wiring, and docs for exporting the authenticated organization's audit logs. Compared to enterprise/server/auditlog.Logger.GetLogs, this endpoint adds stable time-window querying (start_time/end_time) with timestamp validation/defaults, configurable page_size (default 100, max 1000), and exclusive end_time semantics. Unlike GetLogs timestamp-only pagination, this API uses an opaque keyset cursor over (end_time_usec, event_time_usec, audit_log_id), a tuple boundary predicate, and ORDER BY (group_id, event_time_usec, audit_log_id) to match the ClickHouse sort key and avoid same-timestamp pagination ambiguity. The API also reuses shared auditlog row-to-entry conversion and filtering helpers so stable responses match existing enterprise audit-log redaction/formatting behavior.
8236475 to
c65d998
Compare
Contributor
Author
|
Switch to use |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add
api.v1GetAuditLogRPC, schema wiring, docs, and Bazel test coverage for exporting audit logs.start_time/end_time, timestamp validation/defaults, configurablepage_size(default 100, max 1000), and exclusiveend_timesemantics.end_time_usec,event_time_usec, andaudit_log_id, with a tuple boundary predicate andORDER BY (group_id, event_time_usec, audit_log_id)to match the ClickHouse sort key and avoid same-timestamp pagination ambiguity.group_id = user.GetGroupID()).//enterprise/server/api:auditlog_testtarget so the audit-log test runs correctly under Bazel with BuildBuddy RBE enabled.group_idselection so callers can retrieve logs for another organization they are authorized to access.Part of https://github.com/buildbuddy-io/buildbuddy-internal/issues/4844