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
-
OpenTelemetry Semantic Conventions & Resource Attributes Prompt
Standardize span/metric/log attributes and resource attributes across a fleet using OpenTelemetry semantic conventions, so telemetry from many services correlates cleanly and survives convention version changes.
-
OpenTelemetry Collector Security Hardening Prompt
Harden an OpenTelemetry Collector deployment: enable mTLS on OTLP receivers and exporters, add authentication, redact PII with the transform/redaction processors, and lock down the container so telemetry can't be spoofed, sniffed, or leaked.
-
OpenTelemetry Collector Pipeline Design Prompt
Design a production OpenTelemetry Collector configuration with well-ordered receiver, processor, and exporter pipelines for traces, metrics, and logs, tuned for reliability and backpressure.
-
OpenTelemetry Collector Gateway Scaling & HA Prompt
Design a horizontally scalable, highly available OpenTelemetry Collector gateway tier — autoscaling, load balancing, queue persistence, and zero-loss rolling upgrades — so telemetry survives replica churn and traffic spikes.
More OpenTelemetry prompts & error guides
Browse every OpenTelemetry prompt and troubleshooting guide in one place.
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.