JSONL File Store
The JSONL store persists events as one JSON object per line in an append-only file. Events survive process restarts and can be inspected with standard Unix tools.Setup
File Format
Each line is a complete JSON object representing one event:Inspecting Events
JSONL files work with standard Unix tools:File Permissions
The file is created with0o600 permissions — owner read/write only. This prevents other users on the system from reading your audit trail.
Chain Recovery
On initialization, the JSONL store reads the existing file to recover:- last_hash — the hash of the most recent event, so new events chain correctly
- event count — for internal bookkeeping
Corrupt Line Handling
If the JSONL file contains a corrupt line (invalid JSON), the store handles it gracefully:- The corrupt line is skipped during read
- A warning is logged
- The corrupt line’s index is included in
brokenwhen you callverify()
Flushing
Callflush() to ensure all buffered writes are persisted:
When to Use JSONL vs Memory
| Use Case | Recommended Store |
|---|---|
| Unit tests | Memory |
| Development / prototyping | Memory |
| Production services | JSONL |
| Long-running processes | JSONL |
| Serverless functions | JSONL |
| CI/CD audit trails | JSONL |
Next Steps
Configuration
All constructor options for Trailproof.
Verification
Verify chain integrity including JSONL recovery.