← Back

← All guides · Published November 14, 2026 · Reviewed November 14, 2026 · Ingenious AI team

JSON vs JSONL for Agent Logs: Which Format Holds Up?

The short answer

For agent logs, JSONL — one JSON entry per line, appended as actions happen — holds up better over long retention, while a single JSON array suits small, bounded exports; BoundaryVault reads both (native JSON or JSONL on the free tier). The format matters less than the discipline inside it: complete entries, one stable field shape, sequence values, and a final entry that is never left truncated by an unclean shutdown. Check your own log with the free log scan.

Scan my log — free

What is JSONL for agent logs?

JSONL (JSON Lines) is a log format where each line is a complete JSON object, written append-only. A JSON log is typically one array of entry objects. Both carry the same fields the detector reads — timestamp, agent, tool, arguments, sequence — and both are accepted input shapes for a scan.

Append-only writing favours JSONL

An agent log is written by a running system, one action at a time, often for months. JSONL matches that physics: each entry is a self-contained line, written once, never revisited, so a crash costs at most the final partial line — which the integrity audit then flags as a truncated entry, honestly labelled. A single growing JSON array must be rewritten or held open with its closing bracket pending, and an unclean shutdown tends to invalidate the whole structure rather than one entry. For a record whose entire value is surviving to be reviewed, graceful degradation per line beats elegance per file.

Reading and splitting favour JSONL too

Large periods split naturally at line boundaries: per-day or per-agent JSONL files for batch analysis (up to 10 logs on Pro) with no parsing surgery, and any single entry can be lifted out by line number to verify a finding's action index neighbourhood. Streaming readers process a JSONL export without loading it whole — a real consideration at the scale of a month of a busy agent's record. None of this makes JSON wrong: a bounded export from a system that natively stores an array is fine input. It makes JSONL the better default to build on, and the worse one to retrofit under incident pressure.

The truncated-entry signal is a JSONL story

One integrity signal exists because of how appends fail: the truncated final entry, where writing stopped mid-line. In JSONL that damage is local and visible — one broken line at a known position, and the sequence values around it quantify anything missing. The operational fixes are the usual ones: flush on shutdown, write-then-acknowledge at the framework layer, and treat the appearance of a truncated entry in a scan as a prompt to check what else the same shutdown interrupted. A monthly scan that never shows truncations is quiet evidence your shutdown path is clean.

Whichever you choose, freeze the entry shape

Format wars distract from the field discipline that actually decides forensic value: one entry shape, with timestamp, agent, tool, arguments and sequence under consistent names (ts/timestamp/time, agent/agent_id, tool/action/function, args/arguments/params, seq/sequence/index/event_index), for the whole retention period. Mid-period shape changes read to the integrity audit like agent renames and clock problems — explainable, but each explanation is a tax. Pick JSONL if you are choosing today, freeze the shape in a written logging standard, and let format stop being a topic.

A worked example: Atlas Tutor Labs

Example — fictional operator, illustrative numbers. Atlas Tutor Labs, a fictional lesson-planning operator, migrated its agent logging from monthly JSON arrays to daily JSONL after one unclean shutdown invalidated a 2.1 GB monthly array and cost a full day's re-export from the application database. On JSONL, the following quarter produced 92 daily files averaging 118,000 entries; two unclean shutdowns in that period each cost exactly 1 truncated final entry, flagged by the integrity audit and explained in the notes, with sequence values proving nothing else was lost either time.

MeasureFigureWhat it showed
Old formatMonthly JSON arrayOne shutdown invalidated 2.1 GB
New formatDaily JSONL files92 files in the quarter
Entries per fileAbout 118,000Split cleanly for batch scans
Shutdown cost after migration1 truncated entry eachFlagged, explained, nothing else lost

See how the plans differ on log size and batch work on the pricing page, and how the detector reads a log in the detector docs.

The checklist: five actions

  1. Default to JSONL for new logging. Append-only, one complete entry per line, self-contained and crash-cheap.
  2. Split files by day or agent. Natural line boundaries make batch-sized files without editing entries.
  3. Freeze the entry shape. One field-name set for the whole retention period, written into your logging standard.
  4. Flush on shutdown. Protect the final entry; treat any truncated entry in a scan as a shutdown-path bug report.
  5. Keep sequence values regardless. Format does not witness completeness — the counter does, in JSON or JSONL alike.

Run the free log scan · More agent-security tools from Ingenious AI

Related guides

How to Prepare an Agent Log for Scanning

Agent Log Integrity Audit: What the Gap Checks Mean

What Fields Should an AI Agent Log Contain?

How Long Should You Keep AI Agent Logs? An Audit-Trail Retention Guide

Agent Log Forensics: Finding Credential Grabs After the Fact

What Is Scope Escape in an AI Agent?

Building a Disclosure Packet After an Agent Incident

Converting without losing the evidence

Sooner or later a JSONL shop needs a JSON array for some tool, or the reverse. Convert mechanically and keep the original: a converter that parses each line and emits an array preserves every value, while a text-level conversion — brackets and commas by hand — is how entries get merged, split or silently dropped. After converting, count. Entries in, entries out, and the sequence range unchanged; those three numbers are the conversion's whole quality certificate, and they belong in the operator notes if the converted copy feeds a scan.

Scan the shape you trust. If the original is JSONL and the audit trail matters, scan the JSONL — BoundaryVault reads both natively — rather than a converted copy whose fidelity you then have to argue for. Conversions are for convenience. Evidence stays in its first form.

Sources

The migration that is not worth doing

If your current format is consistent, complete and scannable, migrating formats for elegance is a poor trade. Every conversion is a chance to drop, merge or re-order entries, and the forensic value of your history lives in its continuity — sequence ranges that run unbroken across quarters, exports that a reviewer can re-scan and match. Change formats when you change writers, at a declared boundary, with the old archive left in its native shape. The fleet that keeps one boring format for years will out-evidence the fleet that chased the better format twice.

Frequently asked questions

Does BoundaryVault accept both JSON and JSONL?

Yes — native JSON or JSONL on the free tier, as recorded entries with timestamp, agent, tool and arguments. The discipline inside the format matters more than the choice.

Why does JSONL survive crashes better?

Each line is a complete object written once. A crash damages at most the final partial line, which the integrity audit flags as truncated; a single JSON array can be invalidated as a whole.

How do I scan a long period?

Split at natural boundaries — per day or per agent — and use batch analysis (Pro, up to 10 logs) with campaign correlation, rather than thinning or sampling the record.

What is a truncated entry?

A final entry whose writing stopped mid-way, usually an unclean shutdown. It is an integrity signal: check what else the shutdown interrupted, using sequence values to size any loss.

Can I convert formats later?

Conversion preserves entries if done field-for-field, but keep the original export with the findings drawn from it — the scanned artefact and the evidence set belong together.