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
Copy file name to clipboardExpand all lines: info/audit-logs.mdx
+10-5Lines changed: 10 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -101,11 +101,14 @@ See the [API reference](https://kernel.sh/docs/api-reference/audit-logs/list-aud
101
101
102
102
## Export audit logs
103
103
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:
105
105
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
107
110
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.
109
112
110
113
<CodeGroup>
111
114
```typescript TypeScript
@@ -182,8 +185,10 @@ func main() {
182
185
```
183
186
</CodeGroup>
184
187
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.
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