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

logs: support setting the source field #355

Open
sudomateo opened this issue Jul 2, 2024 · 2 comments
Open

logs: support setting the source field #355

sudomateo opened this issue Jul 2, 2024 · 2 comments

Comments

@sudomateo
Copy link

Support setting the Ddsource field on the datadogV2.HTTPLogItem struct. The Datadog Send Logs API expects the Ddsource field to be set in order for log items to have a source.

Currently, the transform function sets the Ddtags, Hostname, Message, Service, and AdditionalProperties fields on the datadogV2.HTTPLogItem struct but it does not set the Ddsource field.

func transform(lr plog.LogRecord, host, service string, res pcommon.Resource, logger *zap.Logger) datadogV2.HTTPLogItem {

The workaround right now is to use the undocumented ddtags attribute to set the source tag. Thankfully I was able to find this undocumented attribute in open-telemetry/opentelemetry-collector-contrib#15387 (comment). Here's the transform processor that does that.

processors:
  transform:
    log_statements:
      - context: log
        statements:
          - set(attributes["ddtags"], "source:sudomateo")

However, even with this configuration the log event will end up with two source tags, one with the value defined in the ddtags and the other with the value undefined. I suspect the undefined value is due to the API request not setting the Ddsource field which is why I opened this issue. Here's what one would see in the Datadog user interface with the above workaround configuration.

Screenshot 2024-07-02 at 18 49 20

Please let me know what other information is needed from me. Thank you!

@brettplarson
Copy link

I'm actually seeing a similar but opposite issue using the under documented ddtags workaround you mentioned here.
image

I would love this as well! It seems very hard to set any of the USM / other commonly used tags in Datadog besides service

@sudomateo
Copy link
Author

Just an FYI I submitted open-telemetry/opentelemetry-collector-contrib#34367 since Datadog Support asked me to submit an issue on that repository instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants