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] Fix ARN parsing function to work for ELB ANRs #14316

Merged
merged 2 commits into from
Oct 29, 2019
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -239,6 +239,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Fix performance counter values for windows/perfmon metricset. {issue}14036[14036] {pull}14039[14039]
- Add FailOnRequired when applying schema and fix metric names in mongodb metrics metricset. {pull}14143[14143]
- Convert indexed ms-since-epoch timestamp fields in `elasticsearch/ml_job` metricset to ints from float64s. {issue}14220[14220] {pull}14222[14222]
- Fix ARN parsing function to work for ELB ARNs. {pull}14316[14316]

*Packetbeat*

Expand Down
7 changes: 5 additions & 2 deletions x-pack/metricbeat/module/aws/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,9 @@ func findIdentifierFromARN(resourceARN string) (string, error) {
} else if strings.Contains(arnParsed.Resource, "/") {
resourceARNSplit = strings.Split(arnParsed.Resource, "/")
}
identifier := resourceARNSplit[len(resourceARNSplit)-1]
return identifier, nil

if len(resourceARNSplit) <= 1 {
return resourceARNSplit[0], nil
}
return strings.Join(resourceARNSplit[1:], "/"), nil
}
8 changes: 8 additions & 0 deletions x-pack/metricbeat/module/aws/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,14 @@ func TestFindIdentifierFromARN(t *testing.T) {
"arn:aws:sns:us-east-1:627959692251:notification-topic-1",
"notification-topic-1",
},
{
"arn:aws:elasticloadbalancing:eu-central-1:627959692251:loadbalancer/app/ece-ui/b195d6cf21493989",
"app/ece-ui/b195d6cf21493989",
},
{
"arn:aws:elasticloadbalancing:eu-central-1:627959692251:loadbalancer/net/ece-es-clusters-nlb/0c5bdb3b96cf1552",
"net/ece-es-clusters-nlb/0c5bdb3b96cf1552",
},
}

for _, c := range cases {
Expand Down