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

[Metricbeat] Remove dedot for AWS tag value #19221

Merged
merged 5 commits into from
Jun 17, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Fix compute and pubsub dashboard for googlecloud module. {issue}18962[18962] {pull}18980[18980]
- Fix crash on vsphere module when Host information is not available. {issue}18996[18996] {pull}19078[19078]
- Fix incorrect usage of hints builder when exposed port is a substring of the hint {pull}19052[19052]
- Remove dedot for tag values in aws module. {issue}19112[19112] {pull}19221[19221]

*Packetbeat*

Expand Down
5 changes: 3 additions & 2 deletions x-pack/metricbeat/module/aws/cloudwatch/cloudwatch.go
Original file line number Diff line number Diff line change
Expand Up @@ -616,9 +616,10 @@ func insertTags(events map[string]mb.Event, identifier string, resourceTagMap ma
for _, v := range subIdentifiers {
tags := resourceTagMap[v]
if len(tags) != 0 {
// By default, replace dot "." using underscore "_" for tag keys and values
// By default, replace dot "." using underscore "_" for tag keys.
// Note: tag values are not dedotted.
for _, tag := range tags {
events[identifier].RootFields.Put("aws.tags."+common.DeDot(*tag.Key), common.DeDot(*tag.Value))
events[identifier].RootFields.Put("aws.tags."+common.DeDot(*tag.Key), *tag.Value)
}
continue
}
Expand Down
5 changes: 3 additions & 2 deletions x-pack/metricbeat/module/aws/ec2/ec2.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,10 @@ func (m *MetricSet) createCloudWatchEvents(getMetricDataResults []cloudwatch.Met
}
}

// By default, replace dot "." using under bar "_" for tag keys and values
// By default, replace dot "." using under bar "_" for tag keys.
kaiyan-sheng marked this conversation as resolved.
Show resolved Hide resolved
// Note: tag values are not dedotted.
for _, tag := range tags {
events[instanceID].ModuleFields.Put("tags."+common.DeDot(*tag.Key), common.DeDot(*tag.Value))
events[instanceID].ModuleFields.Put("tags."+common.DeDot(*tag.Key), *tag.Value)
}

machineType, err := instanceOutput[instanceID].InstanceType.MarshalValue()
Expand Down
5 changes: 3 additions & 2 deletions x-pack/metricbeat/module/aws/rds/rds.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,12 @@ func (m *MetricSet) getDBInstancesPerRegion(svc rdsiface.ClientAPI) ([]string, m
}

for _, tag := range outputListTags.TagList {
// By default, replace dot "." using under bar "_" for tag keys and values
// By default, replace dot "." using under bar "_" for tag keys.
kaiyan-sheng marked this conversation as resolved.
Show resolved Hide resolved
// Note: tag values are not dedotted.
dbDetails.tags = append(dbDetails.tags,
aws.Tag{
Key: common.DeDot(*tag.Key),
Value: common.DeDot(*tag.Value),
Value: *tag.Value,
})
}
dbDetailsMap[*dbInstance.DBInstanceIdentifier] = dbDetails
Expand Down
6 changes: 3 additions & 3 deletions x-pack/metricbeat/module/aws/rds/rds_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func TestGetDBInstancesPerRegion(t *testing.T) {
dbIdentifier: dbInstanceIdentifier,
dbStatus: dbInstanceStatus,
tags: []aws.Tag{
{Key: "dept_name", Value: "eng_software"},
{Key: "dept_name", Value: "eng.software"},
{Key: "created-by", Value: "foo"},
},
}
Expand Down Expand Up @@ -177,7 +177,7 @@ func TestGetDBInstancesPerRegionWithTagsFilter(t *testing.T) {
dbIdentifier: dbInstanceIdentifier,
dbStatus: dbInstanceStatus,
tags: []aws.Tag{
{Key: "dept_name", Value: "eng_software"},
{Key: "dept_name", Value: "eng.software"},
{Key: "created-by", Value: "foo"},
},
}
Expand Down Expand Up @@ -208,7 +208,7 @@ func TestGetDBInstancesPerRegionWithDotInTag(t *testing.T) {
dbIdentifier: dbInstanceIdentifier,
dbStatus: dbInstanceStatus,
tags: []aws.Tag{
{Key: "dept_name", Value: "eng_software"},
{Key: "dept_name", Value: "eng.software"},
{Key: "created-by", Value: "foo"},
},
}
Expand Down