Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Datadog exporter not rendering log attributes correctly #26382

Closed
paulius-valiunas opened this issue Sep 4, 2023 · 6 comments · Fixed by #29633
Closed

Datadog exporter not rendering log attributes correctly #26382

paulius-valiunas opened this issue Sep 4, 2023 · 6 comments · Fixed by #29633
Labels
data:logs Logs related issues enhancement New feature or request exporter/datadog Datadog components priority:p2 Medium

Comments

@paulius-valiunas
Copy link

paulius-valiunas commented Sep 4, 2023

Component(s)

exporter/datadog

What happened?

Datadog exporter does not export logs in a format that Datadog UI can render correctly

Description

Datadog does not support nested JSON structures in log attributes, so if I have a log message with attributes like:

{
  "foo": "value1",
  "bar": {
    "baz": "some value with \"escaped\" characters",
    "iRanOutOfNames": 2,
    "soIPutSomeGibberishHere": 3
  }
}

foo will be rendered correctly, but the value of bar will appear as a JSON string with all the entries squished into one line, as opposed to being correctly rendered as a tree.

However, if I manually convert the attributes to this (in my application, before sending logs to the collector):

{
  "foo": "value1",
  "bar.baz": "some value with \"escaped\" characters",
  "bar.iRanOutOfNames": 2,
  "bar.soIPutSomeGibberishHere": 3
}

Then bar will be rendered as an expandable tree branch with the children baz, iRanOutOfNames and soIPutSomeGibberishHere.

Steps to Reproduce

  1. Have a Datadog exporter
  2. Log something with nested attributes (like the first example above)

Expected Result

Datadog shows baz, iRanOutOfNames and soIPutSomeGibberishHere as separate attributes under the parent bar. I should be able to see correctly rendered (unescaped) some value with "escaped" characters next to the property name baz.

Actual Result

Instead, Datadog shows bar as a single attribute with the JSON structure all squished into one line with JSON escape sequences etc.

Collector version

0.70.0

Environment information

Environment

Using opentelemetry-operator Helm chart version 0.24.0

OpenTelemetry Collector configuration

No response

Log output

No response

Additional context

No response

@paulius-valiunas paulius-valiunas added bug Something isn't working needs triage New item requiring triage labels Sep 4, 2023
@github-actions github-actions bot added the exporter/datadog Datadog components label Sep 4, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Sep 4, 2023

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

@mx-psi mx-psi added priority:p2 Medium data:logs Logs related issues and removed needs triage New item requiring triage labels Sep 4, 2023
@songy23 songy23 added enhancement New feature or request and removed bug Something isn't working labels Sep 5, 2023
@peter-tar
Copy link

I would be interested in a fix for this as well. Experiencing the same behaviour running the latest versions (opentelemetry-collector: 0.85.0, opentelemetry-operator: 0.39.1)

@peter-tar
Copy link

Are there any updates regarding this? The only workaround currently is to set up custom grok rules for every single nested field in Datadog which isn't ideal.

@paulius-valiunas
Copy link
Author

Are there any updates regarding this? The only workaround currently is to set up custom grok rules for every single nested field in Datadog which isn't ideal.

"isn't ideal" is a huge understatement. A more accurate description would be "as far away as it gets from anything that could be considered a real option"

mackjmr added a commit to DataDog/opentelemetry-mapping-go that referenced this issue Dec 1, 2023
mackjmr added a commit to DataDog/opentelemetry-mapping-go that referenced this issue Dec 1, 2023
mackjmr added a commit to DataDog/opentelemetry-mapping-go that referenced this issue Dec 1, 2023
mackjmr added a commit to DataDog/opentelemetry-mapping-go that referenced this issue Dec 1, 2023
* OTEL-919: Add support for nested log attributes

This PR adds support for nested log attributes.

Fixes: open-telemetry/opentelemetry-collector-contrib#26382

* address feedback

* make fmt
mx-psi pushed a commit that referenced this issue Dec 4, 2023
**Description:** 
This PR updates `pkg/otlp/logs` to bring in the changes from the
following PR:
DataDog/opentelemetry-mapping-go#207.

**Link to tracking Issue:** #26382

Fixes #26382
@mackjmr
Copy link
Member

mackjmr commented Dec 4, 2023

@paulius-valiunas @peter-tar thanks for reporting, this will be fixed in the next release.

If you are using the filelog receiver to collect your json logs, please make sure you are using the json_parser:

    operators:
      - type: json_parser

@peter-tar
Copy link

Thanks @mackjmr, I'm looking forward to trying the fix out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
data:logs Logs related issues enhancement New feature or request exporter/datadog Datadog components priority:p2 Medium
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants