ShowMerit

Mask Tokens and Drop Health Check Spans With OTTL Before They Reach Splunk

On EKS, one OTTL statement in a gateway Collector masked a customer token in all 60 spans of 20 sample traces in Splunk APM, and a filter took health-check spans out of APM while metrics kept counting them. Naming url.query and url.full alone left it in http.target and http.url.

Rechecked 1 Dec 2026: works with splunk-otel-collector chart 0.163.1 and 0.165.0 (on a GitHub runner)

Abhimanyu BajajPublished 18 Nov 20267 min readTested in eu-central-1Lab codeLab evidence

Run this yourself

On your AWS account

The full lab with your own AWS account and Splunk token. Follow the steps below, then run its clean up step so nothing keeps running.

git clone https://github.com/Abhimanyu9988/showmerit.git
cd showmerit/labs/mask-tokens-and-drop-health-check-spans-with-ottl-before

Every order in my lab carried a customer token in its query string. In Splunk APM, that token sat in 60 spans of every 20 sample traces, under four attributes: url.query, url.full, http.target and http.url. The kubelet's health checks were in the traces too, about 40 a minute per service.

With OTTL in a gateway Collector (contrib 0.165.0), one replace_all_patterns statement masked the token in all 60 spans, in both runs, and one filter condition took every health-check span out of APM. Every sample trace still held both services and at least 3 spans, and the gateway sent on 1,350 spans a run: 450 orders, 3 spans each.

The quick start, naming url.query and url.full, masked those two. The same spans still held the raw token in http.target and http.url, because the services also emitted the older HTTP attribute names, as they do during a semantic-convention migration.

TL;DR

  • Batch only: the token in 60 spans of 20 sample traces, in four attributes.
  • Two named statements (url.query, url.full): 60 spans masked, 60 still holding the token in http.target and http.url.
  • One statement over every attribute value: 0 spans with the token, 60 masked, in both runs.
  • Health checks: 0 in APM with the filter, while the services' own HTTP metric kept counting them.

Spans holding the customer token in Splunk APM per run, by attribute, next to spans with token=REDACTED

Why the token and the health checks end up in traces

In this lab, Python zero-code instrumentation (0.66b2) recorded the URL of every HTTP request on its span, query string included. Splunk's guide to sensitive data says instrumentation that knows a query parameter is sensitive should scrub it before setting url.query, url.path and url.full, and it can only know the names it was built for. How much of the URL to collect by default is still open in semantic-conventions issue 860, "Http client and server span default collection behavior for url.full and url.query attributes". The kubelet's health checks are requests too, and the instrumentation traced them like any other.

Here is what Splunk APM held for the first run, read back trace by trace:

before-1: 20 of 20 sample traces in Splunk APM; fewest spans 3; both services in 20;
  raw token in 60 spans (attributes: http.target(40) http.url(20) url.full(20) url.query(40) ); token=REDACTED in 0 spans

The setup

The OTTL

The three configs differ only in the traces pipeline. Base is batch alone. Both OTTL configs add the same filter; they differ in the transform:

filter/healthchecks:
  error_mode: ignore
  trace_conditions:
    - span.attributes["url.path"] == "/healthz"
transform/redact:            # named.yaml
  error_mode: ignore
  trace_statements:
    - replace_pattern(span.attributes["url.query"], "token=[^&]*", "token=REDACTED")
    - replace_pattern(span.attributes["url.full"], "token=[^&]*", "token=REDACTED")
transform/redact:            # all.yaml
  error_mode: ignore
  trace_statements:
    - replace_all_patterns(span.attributes, "value", "token=[^&]*", "token=REDACTED")

What reached Splunk APM

Run Gateway config Traces found Fewest spans in a trace Spans with the raw token Where Spans with token=REDACTED
before-1, before-2 batch only 20 of 20 3 60 url.query 40, http.target 40, url.full 20, http.url 20 0
named-1, named-2 url.query + url.full 20 of 20 3 60 http.target 40, http.url 20 60
all-1, all-2 every attribute 20 of 20 3 0 none 60

Both runs of each config gave the same counts, and both services were in all 20 traces every time. The 40s and 20s count attribute values: two server spans and one client span per trace.

named-1: ... raw token in 60 spans (attributes: http.target(40) http.url(20) ); token=REDACTED in 60 spans
all-1: 20 of 20 sample traces in Splunk APM; fewest spans 3; both services in 20; raw token in 0 spans (attributes: none); token=REDACTED in 60 spans

So the named statements did exactly what they say. During a migration the same value also lives under the older names, and replace_all_patterns reaches every attribute value, whatever it's called. Adding statements for http.target and http.url would be the narrower alternative.

Health checks: out of traces, still in metrics

Health checks per minute for each config and service: Splunk APM's GET /healthz spans next to the services' HTTP metric and the 36 a minute the probes give

Over the same 10 s points in each config's period, per service:

Config APM, GET /healthz spans Services' HTTP metric, /healthz The probes give about
batch only (250 s) 166 and 166 168 and 163 150
named (140 s) 0 and 0 90 and 90 84
every attribute (130 s) 0 and 0 89 and 85 78

The metric comes from the app itself, so the trace filter doesn't touch it: health-check rates stay visible for alerting while the traces get cleaner. The counts run a little above the probe figure, likely from new pods' first checks after each restart; I didn't measure that.

The gateway's own counters, read right before each load and again after the flush, show the same thing from the other side. In all four OTTL runs it sent on exactly 1,350 spans: 450 orders, 3 spans each, and the filter dropped 92 to 95 health-check spans. The batch-only runs sent everything they received, 1,445 and 1,444.

Spans the gateway sent on and spans the filter dropped in each 45 s load window

What to plan for

Run it in your own account in 3 steps

Step 1: Create the cluster (the EKS cluster took 6m58s in my run)

git clone https://github.com/Abhimanyu9988/showmerit.git
cd showmerit/labs/mask-tokens-and-drop-health-check-spans-with-ottl-before
export AWS_REGION=eu-central-1 TF_VAR_region=eu-central-1 LAB_NAME=ottl-lab TF_VAR_lab_name=ottl-lab
export SPLUNK_REALM=us1 SPLUNK_ACCESS_TOKEN=your-ingest-token SPLUNK_API_TOKEN=your-api-token
terraform init && terraform apply -auto-approve

Step 2: Batch only (about 7 minutes)

Run ./reproduce.sh. It installs the Splunk OTel Collector chart, the gateway and both services, runs before-1 and before-2, and reads before-1's sample traces back from Splunk APM.

Step 3: The two OTTL configs (about 14 minutes)

Run ./fix.sh. It runs named-1, named-2, all-1 and all-2, then reads every run's sample traces and the health checks back from Splunk.

Clean up (the cluster costs money while it runs)

./cleanup.sh
terraform destroy -auto-approve

What I didn't test

Sources

Disclosure: I work at Splunk, part of Cisco. This is my personal blog; the post isn't sponsored or reviewed by my employer.


I built this in a disposable AWS lab. The lab code and raw output are public. Drafted with AI assistance and reviewed by me.

Read next

OpenTelemetry code owner for two Collector components. Writes hands-on AWS container guides, each tested in a lab. See the proof