Skip to content

Commit 7010f3d

Browse files
committed
Clarify SDK audit log download behavior
1 parent bb5c6b6 commit 7010f3d

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

info/audit-logs.mdx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,14 @@ See the [API reference](https://kernel.sh/docs/api-reference/audit-logs/list-aud
101101

102102
## Export audit logs
103103

104-
The export API returns one chunk per request. Export paging uses a cursor rather than the page token used by search; both are opaque values you pass back unchanged.
104+
The SDK download helpers write a complete export to a destination you provide. They:
105105

106-
Repeat requests until `X-Has-More` is `false`, passing `X-Next-Cursor` back as `cursor`. With the `jsonl.gz` format, each chunk is an independent gzip member, and appending the members produces a valid gzip file. With `jsonl`, each chunk contains raw JSON Lines that you can also append.
106+
- request every chunk until the export is complete
107+
- validate pagination metadata and each chunk's SHA-256 checksum before writing
108+
- retry transient HTTP and transfer failures
109+
- append verified chunks in order
107110

108-
The SDK download helpers verify each chunk, retry transient transfer failures, and write the complete export to a destination you provide. They don't close the destination.
111+
The helpers don't close the destination. Python provides equivalent sync and async methods; both accept a synchronous binary destination.
109112

110113
<CodeGroup>
111114
```typescript TypeScript
@@ -182,8 +185,10 @@ func main() {
182185
```
183186
</CodeGroup>
184187

185-
For atomic file replacement and cleanup after failed downloads, use the [CLI download command](/reference/cli/audit-logs#kernel-audit-logs-download).
188+
<Warning>
189+
If a download fails, the destination may contain a partial export. Write to a temporary file and rename it after success, or use the [CLI download command](/reference/cli/audit-logs#kernel-audit-logs-download) for automatic cleanup and atomic replacement.
190+
</Warning>
186191

187192
Export chunks contain one JSON object per line. They use the same fields as search results and add `event_id`, which provides a stable tie-breaker when multiple events share a timestamp.
188193

189-
See the [API reference](https://kernel.sh/docs/api-reference/audit-logs/download-an-audit-log-export-chunk) for the full request and response schema.
194+
For direct HTTP integrations, see the [API reference](https://kernel.sh/docs/api-reference/audit-logs/download-an-audit-log-export-chunk) for pagination headers, formats, and the full request and response schema.

0 commit comments

Comments
 (0)