Write OTTL statements in the transform processor to reshape telemetry

domain: github.com/open-telemetry/opentelemetry-collector-contrib · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Add transformprocessor to your Collector config under processors; set error_mode to ignore or propagate depending on whether a bad statement should drop the record or halt the pipeline
  2. Choose the correct context block for your signal: log_statements for logs, trace_statements for traces, metric_statements for metrics; each context exposes the fields available at that level
  3. Write statements as plain strings using OTTL functions followed by an optional where clause, for example: set(attributes["env"], "production") where resource.attributes["cloud.region"] == "us-east-1"
  4. Use built-in OTTL functions: set(), delete_key(), replace_match(), merge_maps(), and string functions like Concat(), Split(), Upper() to transform field values
  5. Chain multiple statements in a single context block; they execute in order, so later statements can reference fields set by earlier ones
  6. Test statements by enabling debug log level on the Collector (--set=service.telemetry.logs.level=debug); the transform processor logs the TransformContext and which conditions matched

Known gotchas

Related routes

Use the OTel Collector transform processor to modify telemetry with OTTL statements
opentelemetry.io · 5 steps · unrated
Apply OTTL expressions in the OTel Collector transform processor to rename metric data points and remove unwanted attributes
opentelemetry.io · 5 steps · unrated
Configure the OTel Collector routing connector to split telemetry streams by attribute value into separate pipelines
opentelemetry.io · 5 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans