By Abhijith N M · Reviewed 24 October 2026 · Editorial standards
An LLM request necessarily contains the thing you are trying to help with, and that thing is frequently personal. A Waypoint exception can carry a consignee's name, a delivery address, a phone number, a shipment reference and a commercial dispute. The moment that text enters a prompt, it enters every log, trace, evaluation fixture and vendor dashboard your observability stack touches.
The defensible default is to collect less, redact early and keep it briefly. Redaction at the edge means the request body is sanitised before it reaches logging, not filtered later by a query. Hashing identifiers keeps joins possible without keeping the identifiers themselves.
import re
EMAIL = re.compile(r"[\w.+-]+@[\w-]+\.[\w.]+")
PHONE = re.compile(r"\+?\d[\d\s-]{8,}\d")
SHIPMENT = re.compile(r"\bSHP-\d{4,6}\b")
def redact(text: str) -> tuple[str, int]:
redactions = 0
for pattern, label in (
(EMAIL, "[email]"),
(PHONE, "[phone]"),
(SHIPMENT, "[shipment_ref]"),
):
text, count = pattern.subn(label, text)
redactions += count
return text, redactions
raw = (
"Customer Dana Whitfield (dana.whitfield@example.com, +1 415 555 0134) "
"asked about SHP-7781 and SHP-7790."
)
safe, count = redact(raw)
print("redactions:", count)
print(safe)Every data class needs an owner, a maximum retention and a storage location. "Forever in the logs" is not a policy; it is the absence of one. Approval records are the exception that proves the rule: they are the evidence that a human authorised money to move, so they are retained deliberately and access to them is audited.
| Data class | Retention | Where it lives | Access |
|---|---|---|---|
| Request metadata (ids, latency, tokens, no payload) | 90 days | Metrics and logs | Engineering, on-call |
| Redacted prompts and completions | 30 days | Trace backend | Engineering with reason code |
| Raw debug payloads | 24 hours or off | Restricted debug bucket | Incident commander approval only |
| Approval records | 7 years | Audit store, append-only | Compliance and named approvers |
| Evaluation fixtures | 2 years, reviewed | Versioned fixture repo | Engineering, reviewed changes |
| Cost aggregates | 13 months | Billing warehouse | Finance and platform owners |
Key takeaways
Prompts contain user data, so redact at the edge before anything is logged or traced.
Layer redaction: regex for structured identifiers, policy and entity detection for free text, and redact model output too.
Retain each data class deliberately: short for raw payloads, long and audited for approval records.
Sample successes, keep failures, hash identifiers for joins, and audit every read of raw data.
Written and edited by the nexGenCoders team. Spotted a mistake? Tell us and we will fix it.
Don't lose this lesson
Create a free account to save your progress, keep your streak, and work toward a shareable certificate.