Sandbox telemetry

The v8 records DefenseClaw writes for OpenShell sandboxes — phase changes, egress decisions with bytes and duration, asks, policy changes, shadow AI and other findings, processes, integration health — and the attributes that tie them to one sandbox.

Every OpenShell sandbox writes records into the standard observability buckets. They go to local SQLite and to each destination whose routes select them, redacted by that destination's profile. The Sandboxes board and the Splunk Observability sandbox dashboard are built from them. The full attribute registry is docs/OPENSHELL_SANDBOX_EVENTS.md.

What is recorded

What happenedRecord familyBucketNotes
A phase changelog.sandbox.lifecycleagent.lifecycleThe phases are creating, provisioning, starting, ready, stopping, stopped, completed, error, deleting, unknown and deleted. A record names the trigger (create, start, stop, delete, watch, reconcile), the previous phase and the exit code.
A snapshot, undo, mask, review, upload, pull, or the quarantine of a nested repositorylog.sandbox.workspaceenforcement.actionCounts files and lines and lists up to 64 project-relative paths. A state change, and any record that flags files able to run code, is always written to local SQLite.
An egress decision, from the DefenseClaw egress proxy or from OpenShell's own network boundarylog.egress.allowed, log.egress.blockednetwork.egressSource dc-egress-proxy or openshell. A blocked decision is always written to local SQLite.
The end of a connection the proxy allowedlog.egress.completed, log.egress.failednetwork.egressBytes up and down and the duration. failed is a connection the proxy cut short (cancelled, with the bytes), or one whose DNS, connect, TLS or upstream failed (failed, a 502) or timed out (timed_out, a 504).
An ask, and your answerlog.approval.requested, log.approval.resolvedcompliance.activityA resolution says approved, denied, expired or cancelled, who decided (you, triage or policy) and the scope (this sandbox or always).
A policy change: applied, a rule added or removed, an unblock or blocklog.policy.updatedcompliance.activityAlways written to local SQLite. Carries the OpenShell policy revision and the policy hash.
A finding (sandbox.<kind>, see below)log.finding.observedsecurity.finding
A process OpenShell launched or ended, an SSH session, a model calllog.sandbox.process, log.sandbox.ssh, log.sandbox.inferencetool.activity, compliance.activity, model.ioFrom OpenShell's own reports. Process and SSH records are paced per sandbox (a burst of 200, then 20 a second). An inference record names the provider, model, status and latency, never the content.
A process joined or left the process treelog.sandbox.process_treeagent.lifecycleOnly for a sandbox whose tree is on (observe.process_tree, or sandbox run --process-tree). Carries the parent and the ancestry.
The integration's healthlog.subsystem.lifecycle, .ready, .degraded, .restoredplatform.healthSubsystem openshell. A transition is always written to local SQLite.
An AI component found inside a sandboxai_component.*ai.discoveryCarries defenseclaw.sandbox.id and defenseclaw.sandbox.name. See AI discovery.
A hook decisionlog.compat.hook_decisionCarries the sandbox id and name of the binding that authenticated the hook, so a verdict joins to its sandbox.

The audit actions behind them are sandbox-lifecycle, sandbox-workspace, sandbox-egress, sandbox-approval, sandbox-policy, sandbox-health, sandbox-finding, sandbox-activity and sandbox-process; they appear in defenseclaw audit export and the TUI's Audit view.

In Loki the family without its log. prefix is defenseclaw_event_name (for example egress.blocked, finding.observed, sandbox.process_tree).

Which sandbox a record belongs to

Every sandbox record carries these attributes when they are known. An empty value is left out, never guessed.

AttributeMeaning
defenseclaw.sandbox.nameThe sandbox's name. Required on every record except the integration's own health.
defenseclaw.sandbox.idOpenShell's id, once the gateway accepted the sandbox.
defenseclaw.sandbox.driverThe compute driver: docker (the Linux default) or vm (MicroVM: every Mac, and a Linux host with KVM that chose it).
defenseclaw.sandbox.driver_reasonManaged hosts: why the sandbox runs on its driver. configured (the organization set it), kvm_available (driver: auto and the user's KVM probe passed), or, when the Linux docker fallback replaced the MicroVM driver, the probe's reason: kvm_missing, kvm_access, cpu_virtualization, vm_driver_missing or vm_prerequisite_missing. See The docker fallback.
defenseclaw.sandbox.profile, .packThe network profile and the policy pack.
defenseclaw.sandbox.workdir.modemount or copy.
defenseclaw.sandbox.binding.idThe ingress binding the sandbox's hooks and egress proxy credential authenticate with (sb_ and hex; never the token).
user.id, defenseclaw.user.nameThe host account that launched the sandbox.
gen_ai.conversation.idThe harness session the sandbox's hooks last named, on egress, approval, process, SSH and inference records.
defenseclaw.connector.sourceThe sandbox's harness connector.

Sandbox names are never metric labels

The sandbox name, id and binding are attributes of the log records only. The metrics carry the harness connector, the egress source and the decision, so a sandbox that is created and deleted a hundred times does not make a hundred series. Per-sandbox views read the logs, which is why the local Collector moves defenseclaw.sandbox.name onto the log record's resource, where the bundled Loki indexes it.

Managed computers

On a managed host (the enterprise packages, with identity-based sandbox policy) the managed gateway also stamps each sandbox record with what it knows of the sandbox's governance. These attributes are left out on an unmanaged sandbox, and none of them is a metric label.

AttributeMeaning
defenseclaw.sandbox.registration.idThe managed gateway registration the sandbox's hooks and policy requests are bound to (reg-; never the binding token).
defenseclaw.guardrail.profile.name, .digest, .match, .matched_groupThe guardrail profile that governs the sandbox, the digest of its configuration, and why it matched. The same attributes the hook decisions carry.
defenseclaw.sandbox.policy.digestThe digest of the effective sandbox policy: the organization floor combined with the profile's sandbox section.
defenseclaw.sandbox.policy.generationThe managed gateway's configuration generation at the last resolve or re-match.
defenseclaw.sandbox.policy.provisionaltrue while the sandbox runs under default_profile because a directory lookup has not resolved and no assignment needs the missing fact. A request needing that fact is refused and names it.
defenseclaw.openshell.version, defenseclaw.openshell.install_modeThe OpenShell release the daemon verified, and how it was provided: prerequisite or setup.
defenseclaw.subject.keyAn hmac-sha256: pseudonym of the account, so one person can be followed across records without the principal. The principal itself is recorded only when ai_discovery.include_user_principal is on.

The records the managed computer adds:

What happenedRecordNotes
A registration's profile and sandbox policy were resolvedlog.sandbox.policy.resolvedReason offline_floor for a provisional one.
A live registration was matched againlog.sandbox.policy.rematchedThe reason is generation, facts or lookup_resolved, with the previous profile and policy digest. Always written.
A network rule that nothing accounts for was removed, its sandbox stopped, or only reportedlog.sandbox.policy.foreign_ruleThe action is remove, stop or alert.
The managed gateway decided a person's ask, unblock or blocklog.sandbox.ask.decidedSays whether the decision was kept. Always written.
A required agent was started on the hostlog.sandbox.host_run_refusedAlways written.
This computer cannot provide a sandbox for a required agentlog.sandbox.host_run_unavailableThe reason is one of os_unsupported, no_docker_group, no_docker_access, no_kvm, no_kvm_group, no_kvm_access, prerequisite_missing and similar; the refusal asks the person to quote it, except while the organization's change of the sandbox setup is still being applied: that refusal says to try again in a few minutes and names no contact. An alert-only case has action allow.
A sandbox run refused because another account is using the sandboxes of a single-account computerlog.sandbox.host_run_unavailableThe reason is account_busy and the action refuse. The record carries the refused person's own profile and subject key and names no other account. Repeated attempts are recorded at most once every 5 seconds.
The managed policy refused a destinationlog.sandbox.access_refusedNames the rule and server.address; the rule is the caller's own match only. Always written.
A sandbox or an agent container DefenseClaw did not createlog.sandbox.foreign_sandbox, log.sandbox.foreign_containerA sandbox is stopped, deleted when it cannot stop, or reported; a container is only reported, with its image in defenseclaw.sandbox.container.image. Both carry the account's own profile match and the detected agent connector, including when the account has no registered sandbox.
An OpenShell setting differs from enterprise.openshelllog.sandbox.settings_driftdefenseclaw.openshell.settings.field names the key, never the value. Pauses the user's sandboxes. A changed root-owned gateway.toml render on its own (field gateway_configuration) is reported the same way but does not pause: sandboxes keep starting until the administrator repairs the file, and defenseclaw sandbox status and doctor show the drift. Always written.
A watched registration is used or reported running without an accepted guest record since bind after five minutes, or a running report for a registration reported stopped is refusedlog.sandbox.registration_without_guestThe reason is relay_without_guest, running_without_guest or running_after_stop; action alert, severity MEDIUM, bucket compliance.activity, and no outcome. It names the account, connector, registration, sandbox id and name, and the gateway's running state (ready or stopped phase). The Sandboxes dashboard stat Sandbox registrations without a guest counts these records. It changes no decision and is a tripwire for the simple case: the same account can post lifecycle records, and a dropped first record can cause one alert. See the managed limit.

A refusal, a removal or stop, a re-match and an ask decision are mandatory: they reach the audit floor whatever a route's collection settings say. The Grafana Sandboxes board has a managed fleet section built from these records, including the registration alert stat.

Egress records

An egress record names the destination (server.address, server.port, defenseclaw.network.target_ref), the dialed address, the decision (allow or block), a stable decision code, a short reason and the source. OpenShell's records also name the program that connected (defenseclaw.sandbox.process.executable and .pid); both are what the sandboxed program claims about itself, not something DefenseClaw verified.

Decision codeWhen
SANDBOX_EGRESS_ALLOWEDThe end of an allowed proxy connection (log.egress.completed).
SANDBOX_EGRESS_OPENSHELL_DENIEDOpenShell's own boundary refused the connection.
SANDBOX_EGRESS_HOST_PORT_ASKThe refusal of a --host-port port that raised an ask.
SANDBOX_EGRESS_UPSTREAM_FAILEDThe proxy could not reach the site: DNS, connect, TLS or timeout.
SANDBOX_EGRESS_TERMINATEDThe proxy or OpenShell ended an allowed connection: the large-upload block, the idle timeout, a refused TLS name, a recheck, or a policy reload.
SANDBOX_EGRESS_LOOKUP_REFUSED, SANDBOX_EGRESS_HARNESS_FETCHA refused name lookup, or a request the harness makes on its own and does without. Audited at INFO and not an alert.
SANDBOX_EGRESS_ plus the category (PACK_BLOCK, REPO_POLICY_BLOCK, FIREWALL_BLOCK, OPERATOR_BLOCK, EGRESS_OFF, ...)A refusal by the merged block list, naming whose entry it was.

The model provider's hosts are opened to the harness's own program directly, around the egress proxy, so the proxy records no byte counts for a model call. OpenShell's report of the call is a log.sandbox.inference record.

Findings

A finding's category is sandbox.<kind>:

KindMeaningSeverity
shadow_aiAn AI API the sandbox reached or tried to reach that is neither its model provider nor its harness's vendor. At most once per provider and severity per session.MEDIUM when reached, LOW when refused
hook_silenceThe harness of a user-tier sandbox worked without a hook request reaching DefenseClaw for hooks.silence_after. In balanced and strict the sandbox is stopped.HIGH
hook_tamperA tool ran without a DefenseClaw verdict: a PostToolUse whose PreToolUse was denied or never arrived.HIGH
large_uploadA large upload to a host the sandbox had not contacted before.MEDIUM when only reported, HIGH when the large-upload block cut it
nested_repoA repository or a gitlink appeared inside a live-mounted project during a session.HIGH, CRITICAL when the quarantine failed
ocsf_findingA finding OpenShell raised. Its repeats within 10 minutes of a session are one record.as OpenShell reports

Grafana Sandboxes board, Findings and shadow AI row: Findings by kind counts 2 sandbox.shadow_ai findings, the Shadow-AI destinations table lists api.openai.com and api.mistral.ai as LOW with one finding each, and Recent sandbox findings names the sandbox and the host

Health

Health records use the subsystem openshell. A degraded record carries a stable error code in lower case (defenseclaw.schema.error_code) and a summary that says what to do.

CodeMeaningWhat to do
openshell_unavailableThe OpenShell gateway is not running, is not this account's, or does not answer.defenseclaw sandbox doctor
openshell_egress_auth_failedThe egress proxy refused requests that presented an invalid proxy credential (malformed, unknown, revoked or wrong). A request with none is the normal first step of the handshake and is not counted. One record opens a streak, the daemon log counts the later refusals at most once a minute, and a minute without one ends it with a restored record.A sandbox may hold a stale or revoked credential (an environment from before a restart), or another program on this machine is trying the proxy. The summary names the last destination. defenseclaw sandbox doctor.
openshell_telemetry_failedThe recorder refused a sandbox record. The first refusal of a streak is recorded and logged; every one is counted on defenseclaw sandbox status (the red Telemetry row) and in GET /api/v1/sandbox/status (telemetry_failures, telemetry_error).defenseclaw doctor and the observability destinations.
openshell_watch_failedEvents were lost on a sandbox's stream. A cursor out of range (the gateway restarted, as an upgrade does) is MEDIUM and no alert; one the gateway could not have issued is HIGH.defenseclaw sandbox status NAME

Reconstruct a session

To work out what an agent did in a sandbox, from the records alone:

  1. On the machine, the same facts are one command each: defenseclaw sandbox status NAME (counts, hook traffic, the last blocked call), defenseclaw sandbox activity --sandbox NAME (the feed, in order), defenseclaw sandbox destinations NAME (every host, what it is, how much moved, which program connected), defenseclaw sandbox ps NAME --tree (the processes, when the tree was on), defenseclaw sandbox discover NAME (what the agent installed), and defenseclaw alerts for the findings. Destinations and the last discovery stay after the sandbox stops; ps says when the tree was last sampled. Deleting the sandbox removes them.

  2. defenseclaw audit export --since 1h writes the audit records, hook decisions included, for the same window.

  3. In Grafana, set Sandbox on the Sandboxes board. To read the records in order, open Explore on Loki and filter on the sandbox name, then on one family:

    {service_name="defenseclaw"} | defenseclaw_sandbox_name="myapp-claude"
    {service_name="defenseclaw"} | defenseclaw_sandbox_name="myapp-claude" | defenseclaw_event_name="egress.blocked"

    Another destination (Splunk, a file) holds the same records; filter on defenseclaw.sandbox.name there. In Splunk, the audit action names the kind of record. This search counts a two-hour session's records by action (the search term spl-ua is that sandbox's name):

    Splunk search index=defenseclaw_local spl-ua, then spath and stats count by action, over the last two hours: sandbox-egress 44, connector-hook 43, hook_decision 43, sandbox-process 40, ai_discovery 8, sandbox-activity 6 and sandbox-lifecycle 4

  4. Treat a program's name and arguments as the agent's own words. The tree samples every 5 seconds, so a process shorter than that is missing from it; a connection's program is what OpenShell reports, and its parents appear only for a process the tree saw. The model provider's traffic does not go through the egress proxy, so it has no byte counts, only OpenShell's log.sandbox.inference records.

Metrics

The labels below are the ones the local Prometheus shows. In OTLP they are defenseclaw.connector.source, defenseclaw.metric.source and defenseclaw.metric.decision.

MetricLabelsNotes
defenseclaw.sandbox.active (gauge)connectorSandboxes provisioning, starting, ready or stopping, per harness connector. Exported every minute, including 0 after the connector's last sandbox stops. On a managed host, the daemon refreshes the gateway's count on its polls; after a gateway restart a running sandbox counts again within a minute.
defenseclaw.sandbox.transitions (counter)connector, phase from and toOne per phase change.
defenseclaw.egress.events (counter)connector, source (openshell, dc-egress-proxy), decisionOne per decision; none for the end of a connection. A refusal that is audited only does not count.

Agent Substrate

An Agent Substrate actor writes the same records as an OpenShell sandbox, with defenseclaw.sandbox.runtime set to substrate and defenseclaw.sandbox.driver set to gvisor or microvm. defenseclaw.sandbox.id is the actor UID. The records carry the sandbox correlation plus these attributes. None of them is ever a metric label.

AttributeMeaning
defenseclaw.sandbox.substrate.atespace, .actorThe atespace and the actor name. They are unique only together
defenseclaw.sandbox.substrate.actor_uid, ate.actor.uidThe actor UID. The second is the name Substrate uses on its own records, so the two join. A fork has a new UID
defenseclaw.sandbox.substrate.registeredOn log.egress.*: false when the leader could not tie the decision to a registration of the actor (a deleted actor, one DefenseClaw never registered, or a registration lookup outage at the callout). The atespace and actor name then come from the egress gateway's verified identity, and the actor UID and guardrail profile are absent
defenseclaw.sandbox.substrate.template, .worker_pool, .kit_versionThe template the actor came from, the pool that runs it (absent while suspended) and the DefenseClaw kit release inside
defenseclaw.sandbox.substrate.batch_idThe batch an unattended actor belongs to
defenseclaw.sandbox.substrate.parent_uidThe actor a fork was made from
k8s.cluster.name, k8s.namespace.nameResource attributes of the DefenseClaw component, from the chart. host.name is the pod, never the actor
defenseclaw.user.id_kind=oidc_subject or k8s_userThe person is an OIDC subject, or a Kubernetes user the gateway verified (open-source clusters without OIDC). defenseclaw.user.identity.source is oidc for a person or workload_oidc for CI. defenseclaw.user.principal.assurance is verified only for a person or workload the gateway verified and bound to a live actor UID; anything the actor says about itself is claimed

Lifecycle. sandbox.lifecycle records use the actor phases resuming, ready (Substrate's RUNNING), suspending, suspended, crashed, deleting and reverting, and these triggers: attest (a template was attested or refused), policy_lag, resume_recheck, fork, drift (a foreign change to the egress policy was reverted), policy_conflict, idle_suspend and migrate.

Egress. egress.allowed and egress.blocked from the callout add defenseclaw.network.body_inspected (the callout read the body of an MCP or listed-host POST) and defenseclaw.network.body_over_cap (the body was over the cap and was not read).

Secrets. log.secret.injected records the secret name, the host, the actor (atespace, name and UID, which join to the person on the agent's registration) and the profile, never a value, a prefix or the placeholder. Substrate's egress swaps the value in after DefenseClaw's callout has allowed the request, so the callout writes the record, one per bound secret on every allowed request to a host the secret is bound to, in its log next to log.egress.allowed.

Metrics. None has an identity label. The gateway replicas record them and send them to your OTLP destinations with the other defenseclaw.* metrics. The controller and the callout have no telemetry runtime: they send their counts and records to the leader, and a gateway replica records each one once. The leader keeps what is waiting in memory, egress decisions apart from lifecycle records and counts so a burst of egress never pushes those out. Each holds up to 50,000 records or 16 MiB, and each text field is cut to 512 bytes. Records past that bound, or not yet handed on when the leader restarts, are lost, and the gateway logs how many. OTLP is their only way out: a Substrate pod has no Prometheus /metrics page, and its port 9464 (gateway.ports.metrics) serves only the liveness and readiness probes, so point Prometheus at your collector, not at the pods.

MetricTypeRecorded
defenseclaw.substrate.policy_laghistogram, secondsBy the gateway: a launcher create until the new actor runs with its egress policy. A policy the controller writes again after a change is not counted
defenseclaw.substrate.hook_rtthistogram, msBy the gateway: an actor's hook call from its arrival on the actor listener to the answer (the network leg from the kit is not included)
defenseclaw.substrate.leader_observe_latencyhistogram, msBy the gateway: one tool-chain step sent to the leader, until it answers
defenseclaw.substrate.rate_limitedcounterBy the gateway: calls refused by the fair-share limit
defenseclaw.substrate.first_hook_after_resumehistogram, msNot recorded in this release: Substrate resumes a suspended actor on its own when traffic reaches it, and no DefenseClaw component sees that resume when it happens (the controller sees it at its next pass, seconds late), so there is no start time to measure from
defenseclaw.substrate.unattested_templatesgaugeBy the gateway, from the controller: the templates of the actors on the controller's last pass that carry no valid attestation now. A template no actor uses any more stops counting. Every replica reports the same value
defenseclaw.substrate.idle_suspendscounterBy the gateway, from the controller: actors suspended for being idle
defenseclaw.substrate.policy_conflictscounterBy the gateway, from the controller: actors entering policy_conflict

Refused tokens. A refused actor token (hook, model or relay call) or person token (the launcher on the admin listener) writes one gateway log line, [substrate] <listener> listener refused a token: <reason> (client <class>, <n> since the last line), and one substrate audit row with event: auth_refused, listener, reason, client (loopback, private, link_local, public or unknown, never the address) and count, at most once a minute per listener and reason on each replica. The count says how many refusals the row stands for, so a flood of bad tokens cannot fill the audit store. No metric counts refused tokens in this release: count them from these rows. No line or row holds token bytes, a claim or the verifier's detail. Made or altered tokens (malformed, algorithm, signature, issuer, audience and similar) are MEDIUM; a missing, expired or stale token is INFO.

The Substrate agents board shows them, and the chart can install alert rules for availability, policy lag, conflicts and unattested templates. By default the rules on these metrics read every release's series, so they cover every DefenseClaw cluster that reports to that Prometheus. To scope them to one release, promote the k8s.namespace.name resource attribute where your metrics enter Prometheus (otlp.promote_resource_attributes, or the collector's resource_to_telemetry_conversion) and set the chart value metrics.prometheusRule.namespaceLabel to the label it becomes (k8s_namespace_name). Without the promotion that label is absent and the scoped rules never fire.

What to trust

DefenseClaw reports a sandbox from several sources. Some it measures itself. Some are what OpenShell or the sandboxed program says about itself.

You want to knowLook atRead it as
Which sites the agent reached or triedsandbox activity, sandbox destinations NAME, the TUI details, the Grafana Sandboxes boardMeasured by DefenseClaw for what goes through the proxy. It never sees an HTTPS path or body, and the model provider's traffic is opened around the proxy.
Whether the agent talked to another AI serviceThe shadow AI and shadow AI? kinds, a shadow_ai finding, ⚠ in the feedA provider in the catalog is named. shadow AI? is a guess from the host's shape.
Which program made a connectionThe BINARY column of destinationsWhat the program calls itself. Parents appear only with the process tree on, for a process the 5-second sample saw.
What the agent ransandbox ps NAME --tree (opt-in)Names and arguments are the agent's own words, with secrets replaced. A view of what ran, not a control.
What the agent installed in the sandboxsandbox discover NAME, agent usage --sandbox NAMEFiles as the agent left them, scanned on your machine.
Whether the hooks still guard the agentThe banner's Hooks line, the hook_silence and hook_tamper findingsClaude Code and Codex keep their hooks in root-owned files. For the others, silence stops the sandbox under balanced and strict. A harness that works in bursts shorter than silence_after is not flagged.
What the project asked forThe banner's Policy row, policy explain (source repo)Untrusted input: it can only tighten the policy.

None of these sees what a program does in memory, or the contents of the files the agent writes. The end-of-session review flags the ones that can run code. Every signal is also a v8 record that reaches your telemetry destinations.

What leaves the host

  • The command line of a process is content class: each destination's redaction profile decides whether it leaves the host. Before that, DefenseClaw replaces the values of arguments that name secrets and keeps at most 1,024 bytes.
  • Destinations, file names, finding targets and the program names in a record come from the sandboxed agent. A value that does not fit its registered shape is cut or left out; it never stops the record from being written.
  • The egress proxy never records URL paths or query strings. OpenShell's HTTP events can add the path of a plain-HTTP request.
  • Local SQLite keeps every collected record; the mandatory ones marked above are kept even when a route turns the bucket's collection off.

See also