offplan · online
Decision · 0004-audit-log-retention

0004 — Audit log retention — 12 months active + 7-year archive (pseudonymised)

Approveddecision0004-audit-log-retention

Revision history

Context

The operator dashboard (Phase 1.4.7) and tenant audit surfaces (Phase 1.3 § 2.4) include an audit log of studio/user actions. Retention period affects:

Decision

Three-stage retention model:

  1. 0–12 months — Active retention. Full row in primary audit_events table with all metadata (incl. actor_user_id, IP, user_agent). Queryable by operator dashboard + tenant audit surfaces.
  2. 12 months – 7 years — Archive (pseudonymised). Rows shipped to off-box S3 (Object Lock Compliance mode) in a separate AWS account, write-only cross-account IAM. actor_user_id replaced by hmac_sha256(user_id || global_pepper). Original user_id ↔ hash mapping kept in a separate vault DB with operator dual-approval access (fraud investigation path). sensitive PII fields in JSONB metadata (per Phase 1.3 § 2.4.C pii_class) redacted on shipping; personal_content fields kept (may be re-pseudonymised Stage 2).
  3. After 7 years — Hard delete. Both archive object + vault mapping row purged (scheduled deletion job; audited in operator log). Hard-deletion event itself logged in an out-of-band compliance log.

Immutability + tamper-evidence (Stage 1 mandatory):

Pseudonymisation key (global_pepper):

PII classification (pii_class column):

Class Examples Archival treatment
none pool mode flips, public visibility preset change preserved as-is
personal_meta login success, role change (user_id + IP, no content) actor_user_id pseudonymised, IP kept
personal_content stock allocation, View-as-Agent (touches buyer PII) actor_user_id pseudonymised; JSONB metadata may be kept depending on key registry
sensitive ownership transfer with billing detail, 2FA enable/disable actor_user_id pseudonymised; sensitive metadata keys redacted on shipping

JSONB metadata key registry (audit_metadata_schema.ts) tags each key with pii_class so archival shipping job can redact correctly.

Alternatives Considered

Consequences

Revisit trigger

Cross-references