diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index 7a941d9f9bd6..c4cd32c43786 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -113,6 +113,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d - Fix CPU count in docker/cpu in cases where no `online_cpus` are reported {pull}15070[15070] - Add dedot for tags in ec2 metricset and cloudwatch metricset. {issue}15843[15843] {pull}15844[15844] - Use RFC3339 format for timestamps collected using the SQL module. {pull}15847[15847] +- Add dedot for cloudwatch metric name. {issue}15916[15916] {pull}15917[15917] *Packetbeat* diff --git a/x-pack/metricbeat/module/aws/cloudwatch/cloudwatch.go b/x-pack/metricbeat/module/aws/cloudwatch/cloudwatch.go index 31b3bfc1a3ec..40be8a846cdd 100644 --- a/x-pack/metricbeat/module/aws/cloudwatch/cloudwatch.go +++ b/x-pack/metricbeat/module/aws/cloudwatch/cloudwatch.go @@ -391,7 +391,8 @@ func generateFieldName(namespace string, labels []string) string { // Check if statistic method is one of Sum, SampleCount, Minimum, Maximum, Average // With checkStatistics function, no need to check bool return value here statMethod, _ := statisticLookup(stat) - return "aws." + stripNamespace(namespace) + ".metrics." + labels[metricNameIdx] + "." + statMethod + // By default, replace dot "." using under bar "_" for metric names + return "aws." + stripNamespace(namespace) + ".metrics." + common.DeDot(labels[metricNameIdx]) + "." + statMethod } // stripNamespace converts Cloudwatch namespace into the root field we will use for metrics diff --git a/x-pack/metricbeat/module/aws/cloudwatch/cloudwatch_test.go b/x-pack/metricbeat/module/aws/cloudwatch/cloudwatch_test.go index e13d1e7dce96..9ce957adc7b1 100644 --- a/x-pack/metricbeat/module/aws/cloudwatch/cloudwatch_test.go +++ b/x-pack/metricbeat/module/aws/cloudwatch/cloudwatch_test.go @@ -699,6 +699,12 @@ func TestGenerateFieldName(t *testing.T) { []string{"CPUUtilization", "AWS/EC2", "p10", "InstanceId", "i-1"}, "aws.ec2.metrics.CPUUtilization.p10", }, + { + "test metric name with dot", + "cloudwatch", + []string{"DeliveryToS3.Records", "AWS/Firehose", "Average", "DeliveryStreamName", "test-1"}, + "aws.firehose.metrics.DeliveryToS3_Records.avg", + }, } for _, c := range cases {