← All lessons
Day 49 of 90

Logging for Debugging vs Logging for Compliance

7 min read

Key Concepts

  • 1Debugging logs and compliance logs serve different masters: debugging wants rich detail and fast iteration; compliance wants immutability, retention, and access control
  • 2The conflict: debugging logs often capture full payloads (which may include personal or payment data), but compliance forbids logging sensitive data or demands it be protected
  • 3Compliance logs are evidence — audit trails, consent records, decision rationale — and must be tamper-evident and retained for defined periods, not deleted for space
  • 4Debugging logs are ephemeral by design — verbose, short-lived, sampled — and should be scrubbed of sensitive fields precisely because they're widely accessed
  • 5LLM I/O is a logging minefield: prompts and completions can contain anything, so PII/PCI redaction must happen before logs are written and stored
  • 6Retention policies differ: debug logs age out quickly to control cost and risk; compliance logs must survive for their mandated window regardless of cost
  • 7PMs must design two log paths with different access, retention, and redaction rules — conflating them creates either compliance gaps or debugging blind spots

Why It Matters for PMs

Two purposes, two designs: Treating all logs the same creates either compliance violations or debugging blind spots. PMs must architect distinct paths deliberately.
LLM logging risk: Because model I/O can contain PII/PCI, redaction before storage is a compliance necessity — a landmine unique to agent systems.
Cost and legal balance: Debug logs must age out for cost/risk; compliance logs must persist for legal windows. The retention split is a real architectural decision.

Test Your Understanding

Question 1 (Multiple Choice)

What is a core difference between debugging and compliance logs?

Question 2 (Multiple Choice)

Why is LLM input/output a logging minefield?

Question 3 (Multiple Choice)

Why should debug and compliance logs have different retention policies?

Question 4 (Short Answer)

How would you design two logging paths to satisfy both debugging and compliance needs?

Think about your answer before revealing the explanation.

Question 5 (Short Answer)

Why must sensitive data be redacted before LLM logs are stored, not after?

Think about your answer before revealing the explanation.