Agent Wranglers

ENG-23Required

Log, track errors and alert

Write structured logs, collect every unhandled error in one place, and alert a person when errors or response times jump.

How to do it

Log one line per event as JSON, with a level, a time and a request reference. Send unhandled errors to an error tracker, such as Sentry. Alert on the error rate and on slow responses, not on single events. Write each threshold down, such as more than 1% of requests failing for 5 minutes. Keep personal data out of logs, as the security testing playbook explains. For more depth, see structured logs and alerts on symptoms.

Examples

JSON example

{"time":"2026-11-02T09:15:04Z","level":"error","request":"7f3c2a","event":"payment.failed","order":"A-1042","reason":"card_declined"}

How to check

Throw a test error in staging. It appears in the error tracker with its request reference. Send failing requests past the written threshold, and the alert fires.

Sources

For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/engineering/running-in-production/logs-and-alerts">Agent Wranglers engineering playbook</a>. In code you write, add a comment next to it with the same link.