OCSF JSON Export
The shorthand log format is optimized for humans and agents reading logs in real time. For machine consumption, compliance archival, or SIEM integration, you can enable full OCSF JSON export. This writes every OCSF event as a complete JSON record in JSONL format, one JSON object per line.
Enable JSON Export
Use the ocsf_json_enabled setting to toggle JSON export. The setting can be applied globally, for all sandboxes, or per-sandbox.
Global:
Per-sandbox:
The setting takes effect on the next poll cycle, by default every 10 seconds. No sandbox restart is required.
To disable:
Windows MXC gateways
MXC audit events originate in the Windows gateway rather than an in-sandbox
supervisor. Enable the MXC ETW consumer in gateway.toml, then explicitly opt
the gateway into durable JSONL output:
The sink is available only when Windows selects the MXC driver. It rotates
daily and retains the three most recent files. Diagnostic --log-level values
do not suppress records in this explicitly enabled audit sink.
Output Location
For sandbox supervisors, OCSF JSON records are written to
/var/log/openshell-ocsf.YYYY-MM-DD.log inside the sandbox. Windows MXC gateway
records use %PROGRAMDATA%\OpenShell\logs or OPENSHELL_OCSF_LOG_DIR. Both
sinks rotate daily and retain the three most recent files.
JSON Record Structure
metadata.uid uniquely identifies an event and stays unchanged when that record is serialized again. Use container.uid to associate the event with its sandbox, not metadata.uid. Records without a sandbox association omit the container; unknown images are omitted rather than represented by an empty image name.
Each line is a complete OCSF v1.8.0 JSON object. Here is an example of a network connection event:
And a denied connection:
The JSON examples above are formatted for readability. The actual JSONL file contains one JSON object per line with no whitespace formatting.
OCSF Event Classes in JSON
The class_uid field identifies the event type:
SIEM Schema Version Compatibility
OpenShell emits OCSF v1.8.0 events internally, but many SIEMs only support older schema versions. The ocsf_schema_version setting tells the JSONL layer to downgrade events before writing, stripping fields and profiles that don’t exist in the target version.
Set the target version globally:
Or per-sandbox:
The setting takes effect on the next poll cycle, by default every 10 seconds. No sandbox restart is required.
Supported target versions are 1.1 and 1.3. When set, the JSONL layer applies the following transformations:
- Strips fields added after the target version:
ai_model,container,observation_point_id - Removes unknown profile names from
metadata.profiles:ai_operation,container - Rewrites
metadata.versionto match the target version
The shorthand log output is unaffected. The internal event model stays at v1.8.0; only the serialized JSONL is transformed.
When unset or empty, no downgrade is applied and events are written at the current schema version.
Downgrading is lossy. The ai_model field and ai_operation profile are stripped for v1.1 and v1.3 targets, so AI model attribution is not present in downgraded events. If your audit workflow requires knowing which model handled a request, use the full schema version (leave ocsf_schema_version unset). OpenShell supports OCSF v1.8.0 natively; upgrade your SIEM’s OCSF schema if you need AI attribution alongside backward-compatible ingestion.
Downgraded events include a downgraded_from marker in the unmapped object so auditors can distinguish “no model was involved” from “model attribution was stripped”:
The core OCSF event structure (class UIDs, activity IDs, network and HTTP fields) is identical across v1.1 through v1.8. The stripped fields are all profile-gated additions.
Integration with External Tools
The JSONL file can be shipped to any tool that accepts OCSF-formatted data:
Example with jq to extract all denied connections:
Relationship to Shorthand Logs
Sandbox events identify the sandbox environment with device.type_id: 99 (Other) and device.type: "Sandbox". The operating system is reported separately in device.os.name; the device type does not classify the underlying host or compute backend.
The shorthand format in openshell.YYYY-MM-DD.log and the JSON format in openshell-ocsf.YYYY-MM-DD.log are derived from the same OCSF events. The shorthand is a human-readable projection; the JSON is the full structured record when no schema downgrade is configured. When ocsf_schema_version is set, the JSON export is a lossy projection of the internal event model. Both formats are generated at the same time from the same event data.
The shorthand log is always active. The JSON export is opt-in through ocsf_json_enabled.
Next Steps
- Learn how to read the shorthand format for real-time monitoring.
- Refer to the OCSF specification for the full schema reference.