DEV Community

Alex Georghiou
Alex Georghiou

Posted on

The Audit Log Is Not Your Debug Log

The Audit Log Is Not Your Debug Log

Debug logs answer "What happened inside the process?" Audit records answer "Who did what, to which resource, under what authority, and with what outcome?" They are related but not interchangeable.

A debug log might contain exception details, timings, and transient values. It may be rotated after days. An audit record needs stable identifiers, a deliberate retention policy, access control, and enough information to reconstruct meaningful actions months later.

I prefer audit events at business boundaries: permission granted, limit changed, document approved, record exported. The event should capture an actor identity, action, target, timestamp, request or correlation identifier, and relevant before/after context without copying sensitive data indiscriminately.

Do not assume a row in a mutable database table is tamper-evident. Depending on the requirements, append-only storage, restricted write permissions, integrity checks, and independent retention may matter.

Audit logging can also fail. Decide whether a critical action must be blocked if its audit entry cannot be durably recorded. There is no universal answer. A routine read and a privileged security change have different consequences.

Treat auditability as an explicit requirement during design. Retrofitting it from random application logs is usually too late.

Top comments (0)