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:
Output Location
When enabled, OCSF JSON records are written to /var/log/openshell-ocsf.YYYY-MM-DD.log inside the sandbox. The file rotates daily and retains the 3 most recent files, matching the main log file rotation.
JSON Record Structure
Each line is a complete OCSF v1.7.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:
Integration with External Tools
The JSONL file can be shipped to any tool that accepts OCSF-formatted data:
- Splunk: Use the Splunk OCSF Add-on to ingest OCSF JSONL files.
- Amazon Security Lake: OCSF is the native schema for Security Lake.
- Elastic: Use Filebeat to ship JSONL files with the OCSF field mappings.
- Custom pipelines: Parse the JSONL file with
jq, Python, or any JSON-capable tool.
Example with jq to extract all denied connections:
Relationship to Shorthand Logs
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 complete record. Both are generated at the same time from the same event data.
The shorthand log is always active. The JSON export is opt-in via ocsf_json_enabled.
Next Steps
- Learn how to read the shorthand format for real-time monitoring.
- See the OCSF specification for the full schema reference.