Audit logs provide evidence about important actions such as permission changes, account recovery, exports and administrative updates. They should answer who performed an action, what object was affected, when it happened and whether the operation succeeded.
Define auditable events
Focus on security-sensitive and business-critical actions rather than recording every low-value page view. Include an actor identifier, action name, target identifier, timestamp, outcome and a correlation identifier where useful. Record the source context only to the extent needed and permitted.
Protect log integrity
Restrict write and read access, separate audit storage from ordinary application logs where practical and monitor unexpected gaps. For high-assurance environments, consider append-only or externally retained storage. Application logs alone are not tamper-proof if an attacker controls the application host.
Avoid sensitive payloads
Never record passwords, session tokens, API keys or full payment credentials. Minimize personal data and avoid storing entire form submissions when a concise event is sufficient. Sanitize values that could forge log lines.
Make logs useful
Use a structured format and consistent event names. Ensure timestamps use a documented timezone, ideally UTC for machine processing. Define retention and review responsibilities so logs are not collected without operational purpose.
Checklist
- Record actor, action, target, time and outcome.
- Protect audit data from unauthorized changes.
- Exclude secrets and unnecessary payloads.
- Use structured events and consistent timestamps.
- Define retention, review and alerting responsibilities.