Audit Logs — Guidelines
Rules for what services MUST audit and how — distinct from general observability. Compliance surface, not debug surface.
What MUST be audited
MUST emit an audit event for:
- Every authentication event — sign-in, token issuance, capability grant, MFA challenge, sign-out.
- Every authorisation failure — access denied, capability mismatch, role check failure.
- Every access to security-sensitive data — customer secrets, PII bulk reads, admin queries.
- Every RBAC / access-control change — role assignment, group membership change, capability schema change.
- Every domain state change on a compliance-relevant aggregate — incident ownership, ticket status, customer configuration.
- Every automation action with customer-visible effect — playbook run, autonomous action, notification sent.
- Every DR operation — PITR restore, region failover, key rotation, backup deletion.
- Every data export or bulk extraction.
- Every configuration change to security-critical infrastructure — WAF rules, APIM policies, Front Door routes, network rules, Key Vault access policies.
What MUST NOT be audited
MUST NOT
- Duplicate every HTTP request as an audit event — noise outweighs value.
- Log request or response bodies, customer content, or PII payloads verbatim. Use opaque resource references, approved changed-field names, or digests.
- Log authorization headers, bearer or refresh tokens, capability headers, cookies, complete JWT claims, keys, secrets, or credentials in any form.
Audit event shape
MUST
- Populate every required field in the audit schema
(
auditVersion,id,occurredAt,actor,action,resource,outcome,correlationId). - Use stable, versioned action names
(
incident.owner.change@v1) — never free-text. - Include a bounded change summary for state changes: approved field names and
opaque references or digests. Keep protected values in their authoritative
store rather than copying
beforeandafterpayloads into audit. - Attach the request’s correlation ID to the audit event.
MUST NOT
- Ship untyped audit events.
- Emit audit events without an identified actor (use
service:<sp-id>for system actions).
Emission
MUST
- Emit audit events to the audit Service Bus topic via the platform audit SDK.
- Confirm delivery at-least-once — retry on transient failure.
- Fail the originating operation if the audit emission fails for regulated actions (fail-closed on audit).
SHOULD
- Emit synchronously for high-value actions (auth, admin, DR).
- Emit asynchronously with buffered retry for high-volume domain-state changes.
MUST NOT
- Log an audit event to general observability instead of the audit pipeline.
- Batch-drop audit events under load.
Retention and immutability
MUST
- Rely on the platform-managed WORM policy — services do not configure their own retention.
- Reference audit events by ID + hash — never edit or delete in place.
MUST NOT
- Provision a per-service audit store outside the platform pipeline.
- Attempt to delete audit records administratively — deletions require the compliance-approved workflow.
Access
MUST
- Read audit data only through the platform audit portal / query interface (which itself audits reads).
- Restrict audit read access to security + compliance roles via Entra groups.
MUST NOT
- Copy audit data into a service-local store for convenience.
- Grant broad read access for debugging.
Domain-event overlap
MUST
- For domain state changes, emit both a domain event (to the event store) and an audit event (to the audit pipeline) with the same correlation ID.
- Keep the audit event self-contained — the audit pipeline must not require the event store to answer “did it happen”.
Alerting on audit
MUST
- Wire security alerts on: repeated auth failures per actor, admin data reads outside business hours, WAF / APIM policy changes, failed integrity checks.
SHOULD
- Send audit-derived security alerts to the security on-call rotation, not the general service on-call.
Anti-patterns
- Audit-as-logging — flooding audit with every HTTP call destroys signal.
- Untyped or free-text
action— unqueryable at scale. - PII in
before/after— audit becomes a data breach surface. - Service-local audit stores — fragments the compliance system of record.
- Fail-open on audit emission for regulated actions — invisible policy violations.
- Editing audit records “to fix a mistake” — breaks immutability guarantee.
Related
- Architecture
- Implementation
- ADRs: 0006, 0011, 0012
- Principles: § 13, § 16, § 22
- Capabilities: Observability, Identity, Data Protection