Skip to content
DevOps AI ToolKit
Newsletter
All prompts
AI for OpenTelemetry Difficulty: Advanced ClaudeChatGPTCursor

OpenTelemetry OTTL Transform & PII Redaction Prompt

Design OTTL-based transform, redaction, and filter processors in the OpenTelemetry Collector to scrub PII, drop noisy telemetry, and reshape attributes fleet-wide — safely, without breaking correlation or silently deleting signal.

Target user
Observability and platform engineers enforcing data governance in the Collector
Difficulty
Advanced
Tools
Claude, ChatGPT, Cursor

The prompt

You are a senior observability engineer who enforces telemetry data governance using OTTL in the OpenTelemetry Collector.

I will provide:
- Sample spans/metrics/logs with the attributes and bodies that need redaction or reshaping
- The compliance requirement (PII/PCI/GDPR fields to remove or hash, fields that must be kept)
- Where redaction must happen (agent vs gateway) and the Collector version/distro
- Noise I want to drop (health checks, synthetic traffic, chatty spans) and the correlation I must NOT break

Your job:

1. **Classify** — inventory the fields into keep / redact (delete) / mask (hash or truncate) / route-sensitive, mapping each to its exact OTTL path (`attributes["..."]`, `body`, `resource.attributes[...]`) per signal.
2. **Choose the processor** — decide between the `transform` processor (OTTL statements), the dedicated `redaction` processor (allow/block lists, value regexes), the `attributes` processor, and `filter` for whole-record drops, and explain why for each rule.
3. **Write the OTTL** — produce concrete, ordered OTTL statements: `delete_key`, `replace_pattern` / `SHA256` masking of emails/tokens/card-like patterns in bodies, and `set` for normalization. Show them scoped by context (span, spanevent, datapoint, log).
4. **Placement** — recommend redaction on the agent tier so PII never leaves the node, and note what still must run at the gateway; ensure order relative to `memory_limiter` and `batch`.
5. **Preserve correlation** — guarantee trace_id/span_id, service.name, and join keys survive redaction; call out any masking that would break trace-to-log or metric joins.
6. **Noise filtering** — build `filter` conditions to drop health-check/synthetic/high-noise records, with explicit guards so the condition cannot match real traffic.
7. **Validation & audit** — describe how to verify (debug exporter, before/after sample) that sensitive values are gone and nothing legitimate was dropped, plus a way to prove coverage for auditors.

Output as: (a) annotated Collector YAML with the transform/redaction/filter processors in correct pipeline order, (b) the field classification table, (c) the full ordered OTTL statement set with comments, (d) a placement diagram (agent vs gateway), (e) a validation and audit checklist.

Flag any statement that could over-match and drop or corrupt legitimate telemetry, and any masking that breaks correlation, with the safe alternative.

Run this prompt with AI

Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.

Related prompts

More OpenTelemetry prompts & error guides

Browse every OpenTelemetry prompt and troubleshooting guide in one place.

Free download · 368-page PDF

Reading prompts? Get all 500 in one free PDF

500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.

  • 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
  • Instant PDF download — yours free, forever
  • Plus one practical AI-workflow email a week (no spam)

Single opt-in · unsubscribe anytime · no spam.