## TL;DR

The audit trail's JSON lines are cut off (export limits, log rotation), and strict parsing chokes. Parse each line tolerantly: accept complete lines, salvage fields from truncated ones with pattern matching, and log what was unrecoverable instead of aborting.

## Error

```text
agent failed to parse the concur audit trail: truncated json lines
```

## Steps

1. Read the trail line by line, attempting to parse each as JSON independently. Expected: complete lines parse, truncated ones raise.
2. For lines that fail, try to salvage key fields (timestamp, actor, action) with pattern matching on the partial text. Expected: partial records with the most important fields.
3. Mark salvaged records as partial in the agent's data so downstream logic knows they are incomplete. Expected: no silent treatment of partial data as complete.
4. Log the count and position of unparseable lines. Expected: a measurable data-quality signal.
5. If truncation is systematic (every line cut at the same length), raise the export's line-length limit or switch to the API's paginated trail. Expected: complete lines going forward.

## When to use

- Concur audit-trail JSON lines are truncated.
- One bad line kills the whole trail parse.

## When not to use

- The JSON is complete but deeply nested (see the nested-JSON skill).
- The trail is missing entirely (check export permissions).

## Tool compatibility

- Concur audit-trail exports; custom agent parsers.

## Variant phrasings

### Truncated JSON in audit trail

Same failure, shorter wording.

### Could not parse audit log lines

The generic form.

## Why it happens

Exports and log shippers cap line lengths; long audit entries with embedded details get cut mid-object. A parser that demands complete JSON turns a data-quality issue into a total failure.

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_56PX3BKIMegrlS4vO_hkdw
