You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add stable GetAuditLog API with stable cursor pagination
Add api.v1 GetAuditLog RPC, schema wiring, and docs for exporting audit logs.
Compared to enterprise/server/auditlog.Logger.GetLogs, this API endpoint introduces selector-driven querying (group_id/start_time/end_time) with timestamp validation/defaults, configurable page_size (default 100, max 1000), and end_time exclusive semantics.
Unlike GetLogs timestamp-only pagination, this API uses keyset pagination with a composite cursor (event_time_usec|audit_log_id), tuple predicate, and ORDER BY (group_id, event_time_usec, audit_log_id) to match the ClickHouse sort key and avoid same-timestamp pagination ambiguity.
When selector.group_id is set, parent-org API keys can read child-org logs by re-scoping auth context across raw API-key headers, gRPC metadata, and protolet API-key claims.
Copy file name to clipboardExpand all lines: docs/enterprise-api.md
+108Lines changed: 108 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -319,6 +319,114 @@ message Log {
319
319
}
320
320
```
321
321
322
+
## GetAuditLog
323
+
324
+
The `GetAuditLog` endpoint provides a stable, paginated API for exporting organization audit logs. View full [Audit Log proto](https://github.com/buildbuddy-io/buildbuddy/blob/master/proto/api/v1/audit_log.proto).
// Opaque cursor returned by a previous request, if any.
386
+
string page_token = 2;
387
+
388
+
// Maximum number of entries to return in this page.
389
+
// If unset or less than 1, a server default is used.
390
+
// Values greater than 1000 are capped at 1000.
391
+
int32 page_size = 3;
392
+
}
393
+
```
394
+
395
+
### AuditLogSelector
396
+
397
+
```protobuf
398
+
// The selector used to specify which audit logs to return.
399
+
message AuditLogSelector {
400
+
// Optional inclusive lower bound for event time.
401
+
google.protobuf.Timestamp start_time = 1;
402
+
403
+
// Optional exclusive upper bound for event time.
404
+
google.protobuf.Timestamp end_time = 2;
405
+
}
406
+
```
407
+
408
+
### GetAuditLogResponse
409
+
410
+
```protobuf
411
+
// Response from calling GetAuditLog.
412
+
message GetAuditLogResponse {
413
+
// Audit log entries matching the request. Entry payload fields may evolve
414
+
// over time (new fields may be added and old fields may be removed), so
415
+
// clients should tolerate unknown/missing fields.
416
+
repeated auditlog.Entry entry = 1;
417
+
418
+
// Cursor to retrieve the next page, or empty if there are no more results.
419
+
string next_page_token = 2;
420
+
}
421
+
```
422
+
423
+
### Polling Recommendations
424
+
425
+
- Treat `next_page_token` as opaque. Do not parse it.
426
+
- Keep `start_time` / `end_time` fixed while paginating through one window.
427
+
- Resume by passing the returned `next_page_token` until it is empty.
428
+
- For continuous export, query bounded windows (for example every minute) and checkpoint the last successful window end.
429
+
322
430
## GetTarget
323
431
324
432
The `GetTarget` endpoint allows you to fetch targets associated with a given invocation ID. View full [Target proto](https://github.com/buildbuddy-io/buildbuddy/blob/master/proto/api/v1/target.proto).
0 commit comments