From 2b7b751ccb436cef39a7360ebaa418a1eceb912c Mon Sep 17 00:00:00 2001 From: Michele Mancioppi Date: Thu, 8 Sep 2022 09:52:38 +0200 Subject: [PATCH] Remove ':*' suffix from log group ARN The AWS Distro of OpenTelemetry has issues relating Log Groups with the trailing ':*' suffix (although they are valid ARNs). A fix is in the works, but to ensure comopatibility with the existing deployments, it is best to drop the trailing ':*'. --- detectors/aws/ecs/ecs.go | 2 +- detectors/aws/ecs/ecs_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/detectors/aws/ecs/ecs.go b/detectors/aws/ecs/ecs.go index 4069c6f1956..9c9ae9f369d 100644 --- a/detectors/aws/ecs/ecs.go +++ b/detectors/aws/ecs/ecs.go @@ -185,7 +185,7 @@ func (detector *resourceDetector) getLogsAttributes(metadata *ecsmetadata.Contai return []attribute.KeyValue{ semconv.AWSLogGroupNamesKey.StringSlice([]string{logsOptions.AwsLogsGroup}), - semconv.AWSLogGroupARNsKey.StringSlice([]string{fmt.Sprintf("arn:aws:logs:%s:%s:log-group:%s:*", logsRegion, awsAccount, logsOptions.AwsLogsGroup)}), + semconv.AWSLogGroupARNsKey.StringSlice([]string{fmt.Sprintf("arn:aws:logs:%s:%s:log-group:%s", logsRegion, awsAccount, logsOptions.AwsLogsGroup)}), semconv.AWSLogStreamNamesKey.StringSlice([]string{logsOptions.AwsLogsStream}), semconv.AWSLogStreamARNsKey.StringSlice([]string{fmt.Sprintf("arn:aws:logs:%s:%s:log-group:%s:log-stream:%s", logsRegion, awsAccount, logsOptions.AwsLogsGroup, logsOptions.AwsLogsStream)}), }, nil diff --git a/detectors/aws/ecs/ecs_test.go b/detectors/aws/ecs/ecs_test.go index 99835e0dbb6..d4dce8ef241 100644 --- a/detectors/aws/ecs/ecs_test.go +++ b/detectors/aws/ecs/ecs_test.go @@ -108,7 +108,7 @@ func TestDetectV4LaunchTypeEc2(t *testing.T) { semconv.AWSECSTaskFamilyKey.String("curltest"), semconv.AWSECSTaskRevisionKey.String("26"), semconv.AWSLogGroupNamesKey.StringSlice([]string{"/ecs/metadata"}), - semconv.AWSLogGroupARNsKey.StringSlice([]string{"arn:aws:logs:us-west-2:111122223333:log-group:/ecs/metadata:*"}), + semconv.AWSLogGroupARNsKey.StringSlice([]string{"arn:aws:logs:us-west-2:111122223333:log-group:/ecs/metadata"}), semconv.AWSLogStreamNamesKey.StringSlice([]string{"ecs/curl/8f03e41243824aea923aca126495f665"}), semconv.AWSLogStreamARNsKey.StringSlice([]string{"arn:aws:logs:us-west-2:111122223333:log-group:/ecs/metadata:log-stream:ecs/curl/8f03e41243824aea923aca126495f665"}), } @@ -159,7 +159,7 @@ func TestDetectV4LaunchTypeFargate(t *testing.T) { semconv.AWSECSTaskFamilyKey.String("curltest"), semconv.AWSECSTaskRevisionKey.String("3"), semconv.AWSLogGroupNamesKey.StringSlice([]string{"/ecs/containerlogs"}), - semconv.AWSLogGroupARNsKey.StringSlice([]string{"arn:aws:logs:us-west-2:111122223333:log-group:/ecs/containerlogs:*"}), + semconv.AWSLogGroupARNsKey.StringSlice([]string{"arn:aws:logs:us-west-2:111122223333:log-group:/ecs/containerlogs"}), semconv.AWSLogStreamNamesKey.StringSlice([]string{"ecs/curl/cd189a933e5849daa93386466019ab50"}), semconv.AWSLogStreamARNsKey.StringSlice([]string{"arn:aws:logs:us-west-2:111122223333:log-group:/ecs/containerlogs:log-stream:ecs/curl/cd189a933e5849daa93386466019ab50"}), }