Every outbound connection an AI agent tries inside a Docker Sandbox is checked against policy. For a security team, that decision trail is the most useful signal they have: which agent tried to reach which host, on whose machine, and whether it was allowed. Docker’s documentation now covers this signal in detail through AI Governance Audit Logs, including a new guide on retrieving audit events with the API and a companion page on local audit logs.
This post covers both paths: reading the JSON Lines files the sandbox daemon writes on each host, and querying the same events from Docker Cloud with curl. We also clarify what the feature covers for local sandboxes versus Docker Cloud Sandboxes.
Prerequisites
Check these requirements before anything below will produce data:
- Docker Sandboxes 0.39.0 or later on each host that runs sandboxes.
- A Docker AI Governance plan, a separate paid subscription. Other Docker subscriptions are not enough on their own.
- A Docker organization account with an enforced organization governance policy. Personal accounts are not supported.
- Users who are signed in, hold an AI Governance license, and are governed by that enforced policy.
- An organization owner, or a user with a custom role that includes AI Governance audit permissions, to configure delivery and view hosted events.
- For the API: Docker Cloud delivery turned on, plus an Organization Access Token (OAT) with the View audit logs permission.
curlandjqon the machine you query from.
How Docker Sandboxes produce audit records
The sandbox daemon writes audit records, not the CLI. A command such as sbx create sends a request to the daemon, and the daemon emits the record into its own audit directory on that host.
The daemon writes two kinds of record:
- Evaluation records capture each policy decision: the resource, the action, the verdict, and the reason when a request is denied.
- Session lifecycle records mark the start and end of each daemon run. Every evaluation record carries the same
audit_session_idas its daemon run, so you can tie each decision back to a session.
Records hold metadata only. They do not include prompt content, agent output, or parameter values. A denied network evaluation includes fields such as decision (AUDIT_DECISION_DENY), action_type (network_egress), resource_id (for example example.com:443), deny_reason, agent and hostname. The full field list lives in the audit record reference.
Step 1: Confirm that governance is active on the host
Because audit data only flows for users under an enforced organization policy, the first check is on the developer machine itself. List the active policies:
sbx policy ls
When an organization policy is in effect, the output includes a line of the form Governance: Managed by <org>. If that line is missing, the user is not governed by a centralized policy, and the daemon on that host will not write audit records no matter how delivery is configured. See the sbx policy ls reference for all options.
Step 2: Choose a delivery mode
Docker supports two delivery destinations, and you can use either one or both at the same time:
- Local disk. The sandbox daemon writes
.jsonlfiles on each host. Good for air gapped hosts or your own log shipper. - Docker Cloud. Docker stores the records in Docker Cloud. This powers the hosted audit log view, CSV export, SIEM streaming from app.docker.com, and the Audit Logs API.
Cloud delivery is on by default once AI Governance is enabled. One exception: organizations that used local audit logging before hosted audit logs existed start with cloud delivery off until an owner opts in. To change the setting:
- Sign in to Docker Home and open your organization.
- Go to AI Platform > Audit logs.
- Open Audit Delivery.
- Turn on Local disk, Docker Cloud, or both, then save.
With Docker Cloud selected you also set two retention windows. Searchable retention controls how long events stay searchable in the hosted view, and archive retention controls long term archive storage. Both default to 90 days, and archive retention must be greater than or equal to searchable retention. Reductions apply going forward only. A History view records every delivery change with user, time, and before and after values.
Step 3: Read local JSONL audit files
With local disk delivery on, each host keeps its own records. The default directory depends on the operating system:
- macOS:
~/Library/Logs/com.docker.sandboxes/sandboxes/auditkit/ - Linux:
${XDG_STATE_HOME:-~/.local/state}/sandboxes/sandboxes/auditkit/ - Windows:
%LOCALAPPDATA%\DockerSandboxes\sandboxes\logs\auditkit\
Files follow the pattern audit-<utc-timestamp>-<process-uuid>-<seq>.jsonl. The daemon first appends to a temporary .tmp file, then finalizes it into a .jsonl file with an atomic rename. Finalization happens at a rotation threshold of 5 minutes, 1000 events, or 50 MiB, whichever comes first, and also when the daemon shuts down cleanly. Only .jsonl files are complete.
Since each line is one JSON object, jq works well for quick investigation. On a Linux host using the default path, this prints a compact line for each denied network decision in the finalized files:
jq -c 'select(.decision=="AUDIT_DECISION_DENY" and .action_type=="network_egress") | {timestamp, resource_id, deny_reason}' ~/.local/state/sandboxes/sandboxes/auditkit/*.jsonl
If XDG_STATE_HOME is set on that machine, swap in that base directory. On macOS, point the same filter at the macOS path above. Because the glob only matches *.jsonl, in progress .tmp files are ignored automatically.
Two operational notes. First, sandboxes never delete .jsonl files, so retention and cleanup belong to your log shipper or your own housekeeping job. Second, for central collection, point a shipper such as the Splunk Universal Forwarder, Filebeat or CrowdStrike Falcon LogScale at the audit directory and limit it to .jsonl files. Each line becomes one event in your SIEM.
Step 4: Query cloud events with the Audit Logs API
The Audit Logs API returns the same events as the hosted audit log view, so it suits scripted investigations and reports. It requires Docker Cloud delivery.
Create an Organization Access Token
The API accepts an Organization Access Token only. Personal Access Tokens and Docker account session tokens are not supported. In Docker Home, select your organization, open Identity & auth > Access tokens, select Generate access token, tick View audit logs under the AI Governance organization permissions, and generate it. Store it in a credential manager. Then set two shell variables:
ORG="YOUR_ORGANIZATION_NAME"
OAT="YOUR_ORGANIZATION_ACCESS_TOKEN"
Pass the raw OAT as a bearer token. Do not exchange it for another token first.
List recent events
curl --get "https://api.docker.com/v2/auditlogs/governance/$ORG" \
--header "Authorization: Bearer $OAT" \
--data-urlencode "page_size=25" | jq .
Events come back newest first. The JSON body holds an events array and an opaque next_page_token. Cloud events add fields such as enforcement_mode and ingested_at, and nest resource details under payload.
Filter by decision, action and time
Query parameters narrow the result set. Exact match filters include audit_session_id, username, decision, enforcement_mode (audit, warn or enforce), action_type and agent. resource_id is a case insensitive prefix match, and query runs a case insensitive text search across username, action type, decision and event type. This request pulls denied network egress events for a fixed window:
curl --get "https://api.docker.com/v2/auditlogs/governance/$ORG" \
--header "Authorization: Bearer $OAT" \
--data-urlencode "decision=AUDIT_DECISION_DENY" \
--data-urlencode "action_type=network_egress" \
--data-urlencode "from=2026-08-01T00:00:00Z" \
--data-urlencode "to=2026-08-25T23:59:59Z" | jq .
Time bounds use RFC 3339 and are inclusive. Each request can cover at most 30 days. If you leave out to, it defaults to the request time; if you leave out from, it defaults to 30 days before to. For longer history, split the work into windows of 30 days or less.
Page through results
The default page holds 25 events and page_size is capped at 100. When next_page_token is not empty, pass it back unchanged:
curl --get "https://api.docker.com/v2/auditlogs/governance/$ORG" \
--header "Authorization: Bearer $OAT" \
--data-urlencode "page_size=25" \
--data-urlencode "page_token=$NEXT_PAGE_TOKEN" | jq .
Keep the same filters for the whole result set. The cursor remembers the time range of the first request, including any defaults, so you can drop from and to on later pages. If you do send them, they must match the cursor. Stop when next_page_token comes back empty.
Respect rate limits
The API and gateway each allow 5 requests per second per organization, shared by every client and token in that organization, and every page counts. The gateway also caps traffic at 600 requests per minute per source IP. Over the limit you get 429 Too Many Requests. Application 429 bodies carry structured fields such as code (rate_limit_exceeded) and retry_after_seconds, plus a Retry-After header when the reset time is known. Branch on those fields, and fall back to exponential backoff when the header is missing.
Local Sandboxes vs Cloud Sandboxes
The Docker Sandboxes coverage in AI Governance Audit Logs applies to local sandboxes, meaning sandboxes run by the daemon on a developer machine through the sbx CLI or Docker Desktop. Turning on Docker Cloud delivery changes where those local records are stored. It does not add audit coverage for Docker Cloud Sandboxes.
For network decisions made inside cloud sandboxes, the docs point to a different place: the cloud policy logs described in the cloud network policy guide. In a mixed fleet, local sandbox decisions flow through AI Governance Audit Logs, while cloud sandbox network activity is inspected through cloud policy logs.
Troubleshooting
- No local files appear. Run
sbx policy lsand look for theGovernance: Managed by <org>line. Also confirm the user is signed in and holds an AI Governance license, and that Local disk delivery is on. - Only .tmp files exist. Records are finalized after 5 minutes, 1000 events or 50 MiB, or on clean daemon shutdown. Wait for rotation rather than reading the temporary file.
- Hosted view, CSV export or SIEM forwarding are empty. These all need Docker Cloud delivery. Local delivery alone does not feed them.
- Authentication errors from the API. Use an OAT with View audit logs. PATs and session tokens are not supported.
- 400 Bad Request. Usually invalid parameters, a range over 30 days,
fromnot earlier thanto, or a page token that does not match the supplied time range. Fix the request before retrying. - 503 Service Unavailable or a search timeout. Retry with exponential backoff and narrow the time range or simplify the query.
Key takeaways
- Audit records come from the sandbox daemon, contain metadata only, and are produced only for licensed users under an enforced organization policy.
sbx policy lsis the fastest check that governance is active on a host.- Local delivery writes atomic, rotated
.jsonlfiles that sandboxes never delete; collect only.jsonland own your retention. - Docker Cloud delivery powers the hosted view, CSV export, SIEM forwarding and the Audit Logs API, with configurable searchable and archive retention.
- The API needs an OAT with View audit logs, caps pages at 100 events and windows at 30 days, and enforces 5 requests per second per organization.
- Audit Logs coverage is for local sandboxes; for Docker Cloud Sandboxes, use cloud policy logs.
References
Source guide: Retrieve audit events with the API. Related pages: AI Governance Audit Logs overview, Local audit logs, Configure audit delivery, SIEM forwarding, Audit record reference, sbx policy ls CLI reference and Cloud Sandboxes network policy.