From 5ee94b1cdbf6b8a20789d086a5e21290d00c25f7 Mon Sep 17 00:00:00 2001 From: constanca-m Date: Thu, 12 Oct 2023 16:38:27 +0200 Subject: [PATCH] Remove logger. --- .../processors/add_cloud_metadata/provider_aws_ec2.go | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/libbeat/processors/add_cloud_metadata/provider_aws_ec2.go b/libbeat/processors/add_cloud_metadata/provider_aws_ec2.go index 9918654728e3..a3207491d0ac 100644 --- a/libbeat/processors/add_cloud_metadata/provider_aws_ec2.go +++ b/libbeat/processors/add_cloud_metadata/provider_aws_ec2.go @@ -28,7 +28,6 @@ import ( "github.com/aws/aws-sdk-go-v2/service/ec2" "github.com/aws/aws-sdk-go-v2/service/ec2/types" - "github.com/elastic/elastic-agent-libs/logp" "github.com/elastic/elastic-agent-libs/mapstr" conf "github.com/elastic/elastic-agent-libs/config" @@ -75,12 +74,9 @@ func fetchRawProviderMetadata( client http.Client, result *result, ) { - logger := logp.NewLogger("add_cloud_metadata") - // LoadDefaultConfig loads the EC2 role credentials awsConfig, err := awscfg.LoadDefaultConfig(context.TODO(), awscfg.WithHTTPClient(&client)) if err != nil { - logger.Warnf("error loading AWS default configuration: %s.", err) result.err = fmt.Errorf("failed loading AWS default configuration: %w", err) return } @@ -88,7 +84,6 @@ func fetchRawProviderMetadata( instanceIdentity, err := awsClient.GetInstanceIdentityDocument(context.TODO(), &imds.GetInstanceIdentityDocumentInput{}) if err != nil { - logger.Warnf("error fetching EC2 Identity Document: %s.", err) result.err = fmt.Errorf("failed fetching EC2 Identity Document: %w", err) return } @@ -97,10 +92,7 @@ func fetchRawProviderMetadata( awsRegion := instanceIdentity.InstanceIdentityDocument.Region awsConfig.Region = awsRegion - clusterName, err := fetchEC2ClusterNameTag(awsConfig, instanceIdentity.InstanceIdentityDocument.InstanceID) - if err != nil { - logger.Warnf("error fetching cluster name metadata: %s.", err) - } + clusterName, _ := fetchEC2ClusterNameTag(awsConfig, instanceIdentity.InstanceIdentityDocument.InstanceID) accountID := instanceIdentity.InstanceIdentityDocument.AccountID