Write audit events for the next question
Useful records connect an actor, an authorization decision and an observable effect.
A status code is not the whole event
An HTTP response describes part of a request’s outcome. It may not identify which policy allowed an operation or whether an asynchronous state change later completed. An audit record should reflect the action the application needs to explain.
OWASP’s logging guidance addresses application events, interaction identifiers and information that should be excluded from logs. Designing the event deliberately can improve investigation without collecting every available value.
Choose stable fields
Our proposed event record includes event ID, actor reference, action, resource reference, decision, outcome and correlation ID. Use separate fields when the initiating actor and executing service differ. Reference policy versions when they are needed to reconstruct a decision.
Keep raw credentials and unnecessary payload data out of routine records. If a field is included, identify the question it answers and who is allowed to read it. An audit system should not become the least controlled copy of application data.
Account for delivery
Record how events reach storage, how delivery failures are surfaced and which sources may be incomplete. A query returning no rows is ambiguous without knowledge of coverage. Review the logging path when a new worker, queue or privileged endpoint is introduced.