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

[libbeat] Change aws_elb autodiscover provider field name to aws.elb.* #16402

Merged
merged 2 commits into from
Feb 21, 2020
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 @@ -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*

Expand Down
32 changes: 19 additions & 13 deletions libbeat/docs/shared-autodiscover.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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[]

Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
10 changes: 8 additions & 2 deletions x-pack/libbeat/autodiscover/providers/aws/elb/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the move out of meta and why now in both places?

Copy link
Contributor Author

@kaiyan-sheng kaiyan-sheng Feb 19, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, I forgot to add some explanation in PR description for this. This is to update aws_elb provider to have all the meta fields into autodiscover template by adding it to the root of the event. Please see #14823 (comment) for more details. Thanks!

},
}

Expand Down
10 changes: 8 additions & 2 deletions x-pack/libbeat/autodiscover/providers/aws/elb/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

},
}

Expand Down