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

Bug of Datadog Service Attribute with AWS S3 #804

Open
shintaro202020 opened this issue Jun 12, 2024 · 2 comments
Open

Bug of Datadog Service Attribute with AWS S3 #804

shintaro202020 opened this issue Jun 12, 2024 · 2 comments

Comments

@shintaro202020
Copy link

Describe what happened:
I'm using the log forwarder for cloudwatch logs (Lambda) and s3 object (WAF).
I'd like to change the service attribute for each source.
For the reason above, I set the different service AWS tag in cloudwatch logs and s3 object.
However, service name is only applied with cloudwatch logs and the service name of the log record from the s3 object is waf

Describe what you expected:
The service name of the log record from the s3 record should be service AWS tag which is set in S3 Bucket.

Steps to reproduce the issue:

  1. Store the WAF traffic log with S3 bucket
  2. Set the service AWS Tag in S3 bucket
  3. Set the S3 bucket as a log forwarder lambda trigger
@HannesBBR
Copy link
Contributor

HannesBBR commented Jun 12, 2024

I was looking into the same thing, and I noticed that determining the service is done in https://github.com/DataDog/datadog-serverless-functions/blob/master/aws/logs_monitoring/steps/handlers/s3_handler.py#L53 based on the metadata object, while the tags set on the S3 bucket are only added to the metadata object afterwards in https://github.com/DataDog/datadog-serverless-functions/blob/master/aws/logs_monitoring/steps/handlers/s3_handler.py#L55, which would explain why these tags are ignored for determining the service attribute.

So I believe running self._add_s3_tags_from_cache() before add_service_tag(self.metadata) should solve that (didn't test this yet though).

@HannesBBR
Copy link
Contributor

Created #806 which I think should fix this. I tested this in our stack and now the service attribute on the logs gets correctly set to the value of the service tag on the S3 bucket.

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