aws: derive OTel-compatible trace.id from X-Ray trace ID in elb_logs#20000
aws: derive OTel-compatible trace.id from X-Ray trace ID in elb_logs#20000grahamprimm wants to merge 1 commit into
Conversation
b4b9a51 to
18012ad
Compare
The elb_logs ingest pipeline copied the raw ALB access log trace field
(Root=1-{8 hex}-{24 hex}[;Self=...]) into trace.id verbatim. APM agents
using the X-Ray propagator derive a 32-character hex trace_id from the
same header, so the two values never matched and ELB access logs could
not be correlated with application traces on trace.id.
Replace the verbatim copy with a Painless script that strips the Root=1-
prefix, drops any ;Self=/;Parent= segments, and concatenates the two hex
segments into the OTel/ECS 32-hex form. Unrecognized formats fall back to
the previous raw-copy behavior.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
18012ad to
1bb98f5
Compare
✅ Elastic Docs Style Checker (Vale)No issues found on modified lines! The Vale linter checks documentation changes against the Elastic Docs style guide. To use Vale locally or report issues, refer to Elastic style guide for Vale. |
TL;DRBuildkite failed while uploading the pipeline because the post-checkout hook could not merge PR #20000 with current Remediation
Investigation detailsRoot CauseThe failing step is
Evidence
On current VerificationNot run locally; the failure occurs before test execution during Buildkite checkout/merge, and the log shows deterministic git merge conflicts that must be resolved in the PR branch. What is this? | From workflow: PR Buildkite Detective Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not. |
|
✅ All changelog entries have the correct PR link. |
🚀 Benchmarks reportTo see the full report comment with |
💚 Build Succeeded
History
|
Proposed commit message
aws: derive OTel-compatible trace.id from X-Ray trace ID in elb_logs
WHAT: The
elb_logsingest pipeline copied the raw ALB access log trace field (Root=1-{8 hex}-{24 hex}[;Self=...]) into ECStrace.idverbatim. This change replaces the verbatimsetprocessor with a Painless script that strips theRoot=1-prefix, drops any;Self=/;Parent=segments, and concatenates the two hex segments into the OpenTelemetry/ECS 32-character hex form. Values that don't match the X-Ray v1 format fall back to the previous raw-copy behavior. The raw value remains available unchanged inaws.elb.trace_id.WHY: APM agents using the X-Ray propagator (OTel
xray, AWS X-Ray SDKs) derive a 32-character hextrace_idfrom the sameX-Amzn-Trace-Idheader the ALB writes to its access log. Because the pipeline stored the rawRoot=1-...string, the two values never matched, so ELB access logs could not be correlated with application traces ontrace.idin Kibana. With this change, a request that traverses an ALB lands on the sametrace.idin both the access log and the application spans.Checklist
changelog.ymlfile.Author's Checklist
test-alb.log-expected.json),sample_event.json, and generated docs were updated by hand with the deterministic transform (Root=1-58337262-36d2...→5833726236d2...); please confirm CI pipeline tests regenerate identically.trace.idis acceptable as a minor version bump (raw value still preserved inaws.elb.trace_id).How to test this PR locally
An ALB log line containing
"Root=1-58337262-36d228ad5d99923122bbe354"should producetrace.id: 5833726236d228ad5d99923122bbe354whileaws.elb.trace_idretains the raw value. This matches the trace ID derivation performed by the OTelxraypropagator, e.g. following https://opentelemetry.io/docs/languages/java/configuration/ withOTEL_PROPAGATORS=xray.Related issues
🤖 Generated with Claude Code