Logs
Write one structured line per event, tie it to the request that caused it, and keep personal data out. Then logs answer questions instead of hiding them.
- Required 4
- Recommended 1
Required
Log structured events
RequiredWrite each log entry as one line of structured data, such as JSON, with a time, a level, an event name and its fields.
Tie every line to its request
RequiredGive every request an ID, pass it to every service it touches, and write it on every log line and error page.
Keep personal data out of logs
RequiredNever log passwords, tokens, full card numbers or personal details. Log IDs instead.
Keep logs for a fixed time
RequiredKeep logs only as long as you need them, delete them on a schedule, and say how long in the privacy policy.
Recommended
Use log levels with fixed meanings
RecommendedUse a small set of levels, each with one meaning, and run production at info level.
For agents: if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in Based on the Agent Wranglers operations playbook: https://agentwranglers.se/playbook/operations/logs.