From f9fe1049d46783ed7f48f00b56aee63688eb52bd Mon Sep 17 00:00:00 2001 From: kaiyan-sheng Date: Thu, 20 Feb 2020 19:30:54 -0700 Subject: [PATCH] [libbeat] Change aws_elb autodiscover provider field name to aws.elb.* (#16402) * Change aws_elb autodiscover provider field name to aws.elb.* * add changelog --- CHANGELOG.next.asciidoc | 1 + libbeat/docs/shared-autodiscover.asciidoc | 32 +++++++++++-------- .../providers/aws/elb/_meta/fields.yml | 4 +-- .../providers/aws/elb/provider.go | 10 ++++-- .../providers/aws/elb/provider_test.go | 10 ++++-- 5 files changed, 38 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index 3994cb86681..37a413e7e87 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -12,6 +12,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d - The document id fields has been renamed from @metadata.id to @metadata._id {pull}15859[15859] - Variable substitution from environment variables is not longer supported. {pull}15937{15937} +- Change aws_elb autodiscover provider field name from elb_listener.* to aws.elb.*. {issue}16219[16219] {pull}16402{16402} *Auditbeat* diff --git a/libbeat/docs/shared-autodiscover.asciidoc b/libbeat/docs/shared-autodiscover.asciidoc index 5ddda476ddd..a3911a65490 100644 --- a/libbeat/docs/shared-autodiscover.asciidoc +++ b/libbeat/docs/shared-autodiscover.asciidoc @@ -328,22 +328,28 @@ configs are the same only one will actually run. This provider will load AWS credentials using the standard AWS environment variables and shared credentials files see https://docs.aws.amazon.com/general/latest/gr/aws-access-keys-best-practices.html[Best Practices for Managing AWS Access Keys] for more information. If you do not wish to use these, you may explicitly set the `access_key_id` and `secret_access_key` variables. -These are the available fields during within config templating. The `elb_listener.*` fields will be available on each emitted event. +These are the available fields during within config templating. The `aws.elb.*` fields will be available on each emitted event. * host * port - * elb_listener.listener_arn - * elb_listener.load_balancer_arn - * elb_listener.protocol - * elb_listener.type - * elb_listener.scheme - * elb_listener.availability_zones - * elb_listener.created - * elb_listener.state - * elb_listener.ip_address_type - * elb_listener.security_groups - * elb_listener.vpc_id - * elb_listener.ssl_policy + + * cloud.availability_zone + * cloud.provider + * cloud.region + + * aws.elb.listener_arn + * aws.elb.load_balancer_arn + * aws.elb.protocol + * aws.elb.type + * aws.elb.scheme + * aws.elb.availability_zones + * aws.elb.created + * aws.elb.state.code + * aws.elb.state.reason + * aws.elb.ip_address_type + * aws.elb.security_groups + * aws.elb.vpc_id + * aws.elb.ssl_policy include::../../{beatname_lc}/docs/autodiscover-aws-elb-config.asciidoc[] diff --git a/x-pack/libbeat/autodiscover/providers/aws/elb/_meta/fields.yml b/x-pack/libbeat/autodiscover/providers/aws/elb/_meta/fields.yml index 70759d53b3a..a36ec9e2510 100644 --- a/x-pack/libbeat/autodiscover/providers/aws/elb/_meta/fields.yml +++ b/x-pack/libbeat/autodiscover/providers/aws/elb/_meta/fields.yml @@ -1,11 +1,11 @@ -- key: elb_listener +- key: aws.elb title: "ELB Listener" description: > AWS ELB Listeners short_config: false release: experimental fields: - - name: elb_listener + - name: aws.elb type: group description: > Represents an AWS ELB Listener, e.g. a port on an ELB. diff --git a/x-pack/libbeat/autodiscover/providers/aws/elb/provider.go b/x-pack/libbeat/autodiscover/providers/aws/elb/provider.go index 1f1eec2621e..f6aa90f1e99 100644 --- a/x-pack/libbeat/autodiscover/providers/aws/elb/provider.go +++ b/x-pack/libbeat/autodiscover/providers/aws/elb/provider.go @@ -131,9 +131,15 @@ func (p *Provider) onWatcherStart(arn string, lbl *lbListener) { "id": arn, "host": lblMap["host"], "port": lblMap["port"], + "aws": common.MapStr{ + "elb": lbl.toMap(), + }, + "cloud": lbl.toCloudMap(), "meta": common.MapStr{ - "elb_listener": lbl.toMap(), - "cloud": lbl.toCloudMap(), + "aws": common.MapStr{ + "elb": lbl.toMap(), + }, + "cloud": lbl.toCloudMap(), }, } diff --git a/x-pack/libbeat/autodiscover/providers/aws/elb/provider_test.go b/x-pack/libbeat/autodiscover/providers/aws/elb/provider_test.go index 0f7bd0f66c6..bba3b69f5b9 100644 --- a/x-pack/libbeat/autodiscover/providers/aws/elb/provider_test.go +++ b/x-pack/libbeat/autodiscover/providers/aws/elb/provider_test.go @@ -110,9 +110,15 @@ func Test_internalBuilder(t *testing.T) { "start": true, "host": *lbl.lb.DNSName, "port": *lbl.listener.Port, + "aws": common.MapStr{ + "elb": lbl.toMap(), + }, + "cloud": lbl.toCloudMap(), "meta": common.MapStr{ - "elb_listener": lbl.toMap(), - "cloud": lbl.toCloudMap(), + "aws": common.MapStr{ + "elb": lbl.toMap(), + }, + "cloud": lbl.toCloudMap(), }, }