Skip to content

ParseJSON failing should not drop logs from being exported #43607

@rcheng-roadie

Description

@rcheng-roadie

Component(s)

processor/transform

Is your feature request related to a problem? Please describe.

Settings

image:
  repository: otel/opentelemetry-collector-contrib
  tag: 0.137.0
repoURL: 'https://open-telemetry.github.io/opentelemetry-helm-charts'
          targetRevision: 0.136
          chart: opentelemetry-collector

Kubernetes v1.32

    transform:
      error_mode: ignore
      log_statements:
        - error_mode: ignore
          context: log
          statements:
            - merge_maps(log.cache, ParseJSON(log.body), "insert") where IsMatch(log.body, "^\\{")
            - set(log.attributes, log.cache)

Issue

Currently logs that are JSON but with non-structured elements within tensed values are being dropped ue to ParseJSON. Although below is valid json, since log.body.value is not, ParseJson/transform errors and drop logs although error_mode: ignore. This log is therefore not exported.

    {
        "level": "INFO",
        "value": "{\"message_id\":\"ce5fa37f-7880-4254-9bdc-7412b89848ad\"}",
        "timestamp": "2025-10-16T16:29:01.794Z"
    }

ParseJSON however fails on the below but the log still gets exported.

    {
        "level": "INFO",
        "timestamp": "2025-10-16T16:29:01.794Z"
    } | NR-LINKING....

Describe the solution you'd like

Expected Scenario:

ParseJSON fails but logs are still exported.

Body.value = {"level":"INFO","value":"{\"message_id\":\"ce5fa37f-7880-4254-9bdc-7412b89848ad\"}","timestamp":"2025-10-16T16:29:01.794Z"}

Best case scenario:

log.body.value should be treated as string.

Attributes.level = INFO
Attributes.value ="{\"message_id\":\"ce5fa37f-7880-4254-9bdc-7412b89848ad\"}"
Attributes.timestamp = "2025-10-16T16:29:01.794Z"

Describe alternatives you've considered

No response

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