agent failed to parse the concur audit trail: truncated json lines error
Fixes agent parsing of truncated JSON lines in Concur audit trails with tolerant line handling. Use when audit-trail JSON lines are truncated and parsing fails. Not for well-formed nested JSON.
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
agent failed to parse the concur audit trail: truncated json linesSteps
- Read the trail line by line, attempting to parse each as JSON independently. Expected: complete lines parse, truncated ones raise.
- 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.
- 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.
- Log the count and position of unparseable lines. Expected: a measurable data-quality signal.
- 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/pst56PX3BKIMegrlS4vOhkdw