Skip to content

[exporter/splunkhec] hec exporter escapes HTML when performing json marshalling #46545

@zpzhuSplunk

Description

@zpzhuSplunk

Component(s)

exporter/splunk_hec

What happened?

Description

The hec exporter client uses Go’s JSON marshaling which escapes HTML characters (<, >, &) as Unicode sequences (\u003c, \u003e, \u0026). That caused log bodies and other Event.event values containing these characters to be sent to Splunk with escapes instead of the original characters.

Steps to Reproduce

  1. Set up collector with splunkhecreceiver and splunkhecexpoerter
    2.Send a hec payload with event body set to "<" ">" or "&"

Expected Result

The event should contain "<" ">" or "&" depending on what's sent.

Actual Result

"\u003c", "\u003e", "\u0026" depending on what's sent.

Collector version

v0.146.0

Environment information

Environment

OS: (e.g., "Ubuntu 20.04")
Compiler(if manually compiled): (e.g., "go 14.2")

OpenTelemetry Collector configuration

Log output

Additional context

No response

Tip

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions