From a248e8ddfaa7ae8a42d3b6bf44b0f59342ed5f20 Mon Sep 17 00:00:00 2001 From: Valentin Vetter Date: Tue, 30 May 2017 14:23:17 +0200 Subject: [PATCH] Add instance_name in GCE cloud processor (#4414) --- CHANGELOG.asciidoc | 1 + filebeat/docs/fields.asciidoc | 6 ++++++ heartbeat/docs/fields.asciidoc | 6 ++++++ libbeat/processors/add_cloud_metadata/_meta/fields.yml | 4 ++++ .../processors/add_cloud_metadata/provider_google_gce.go | 1 + .../add_cloud_metadata/provider_google_gce_test.go | 2 ++ metricbeat/docs/fields.asciidoc | 6 ++++++ packetbeat/docs/fields.asciidoc | 6 ++++++ winlogbeat/docs/fields.asciidoc | 6 ++++++ 9 files changed, 38 insertions(+) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index b87c542fc802..27a847c3bedf 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -63,6 +63,7 @@ https://github.com/elastic/beats/compare/v6.0.0-alpha1...master[Check the HEAD d - Added the possibility to set Elasticsearch mapping template settings from the Beat configuration file. {pull}4284[4284] {pull}4317[4317] - Add a variable to the SysV init scripts to make it easier to change the user. {pull}4340[4340] - Add the option to write the generated Elasticsearch mapping template into a file. {pull}4323[4323] +- Add instance_name in GCE add_cloud_metadata processor. {pull}4414[4414] *Filebeat* - Add experimental Redis slow log prospector type. {pull}4180[4180] diff --git a/filebeat/docs/fields.asciidoc b/filebeat/docs/fields.asciidoc index bbe7e419a646..9e81cca808a4 100644 --- a/filebeat/docs/fields.asciidoc +++ b/filebeat/docs/fields.asciidoc @@ -547,6 +547,12 @@ Name of the cloud provider. Possible values are ec2, gce, or digitalocean. Instance ID of the host machine. +[float] +=== meta.cloud.instance_name + +Instance name of the host machine. + + [float] === meta.cloud.machine_type diff --git a/heartbeat/docs/fields.asciidoc b/heartbeat/docs/fields.asciidoc index 5e3cbd4ab2ac..ec2b374cd689 100644 --- a/heartbeat/docs/fields.asciidoc +++ b/heartbeat/docs/fields.asciidoc @@ -135,6 +135,12 @@ Name of the cloud provider. Possible values are ec2, gce, or digitalocean. Instance ID of the host machine. +[float] +=== meta.cloud.instance_name + +Instance name of the host machine. + + [float] === meta.cloud.machine_type diff --git a/libbeat/processors/add_cloud_metadata/_meta/fields.yml b/libbeat/processors/add_cloud_metadata/_meta/fields.yml index 03e364c013f9..1347d04de003 100644 --- a/libbeat/processors/add_cloud_metadata/_meta/fields.yml +++ b/libbeat/processors/add_cloud_metadata/_meta/fields.yml @@ -13,6 +13,10 @@ description: > Instance ID of the host machine. + - name: meta.cloud.instance_name + description: > + Instance name of the host machine. + - name: meta.cloud.machine_type example: t2.medium description: > diff --git a/libbeat/processors/add_cloud_metadata/provider_google_gce.go b/libbeat/processors/add_cloud_metadata/provider_google_gce.go index f6a84ccde089..beb3c2aabed1 100644 --- a/libbeat/processors/add_cloud_metadata/provider_google_gce.go +++ b/libbeat/processors/add_cloud_metadata/provider_google_gce.go @@ -16,6 +16,7 @@ func newGceMetadataFetcher(config common.Config) (*metadataFetcher, error) { if instance, ok := m["instance"].(map[string]interface{}); ok { s.Schema{ "instance_id": c.StrFromNum("id"), + "instance_name": c.Str("name"), "machine_type": c.Str("machineType"), "availability_zone": c.Str("zone"), }.ApplyTo(out, instance) diff --git a/libbeat/processors/add_cloud_metadata/provider_google_gce_test.go b/libbeat/processors/add_cloud_metadata/provider_google_gce_test.go index 87f8447d789c..de6ed3d5e9a5 100644 --- a/libbeat/processors/add_cloud_metadata/provider_google_gce_test.go +++ b/libbeat/processors/add_cloud_metadata/provider_google_gce_test.go @@ -24,6 +24,7 @@ const gceMetadataV1 = `{ } ], "hostname": "test-gce-dev.c.test-dev.internal", + "name": "test-gce-dev", "id": 3910564293633576924, "image": "", "licenses": [ @@ -137,6 +138,7 @@ func TestRetrieveGCEMetadata(t *testing.T) { "cloud": common.MapStr{ "provider": "gce", "instance_id": "3910564293633576924", + "instance_name": "test-gce-dev", "machine_type": "projects/111111111111/machineTypes/f1-micro", "availability_zone": "projects/111111111111/zones/us-east1-b", "project_id": "test-dev", diff --git a/metricbeat/docs/fields.asciidoc b/metricbeat/docs/fields.asciidoc index e04e82ccf073..d11d9c5faad9 100644 --- a/metricbeat/docs/fields.asciidoc +++ b/metricbeat/docs/fields.asciidoc @@ -2663,6 +2663,12 @@ Name of the cloud provider. Possible values are ec2, gce, or digitalocean. Instance ID of the host machine. +[float] +=== meta.cloud.instance_name + +Instance name of the host machine. + + [float] === meta.cloud.machine_type diff --git a/packetbeat/docs/fields.asciidoc b/packetbeat/docs/fields.asciidoc index 1783be6ddb11..1e65b85aef87 100644 --- a/packetbeat/docs/fields.asciidoc +++ b/packetbeat/docs/fields.asciidoc @@ -1066,6 +1066,12 @@ Name of the cloud provider. Possible values are ec2, gce, or digitalocean. Instance ID of the host machine. +[float] +=== meta.cloud.instance_name + +Instance name of the host machine. + + [float] === meta.cloud.machine_type diff --git a/winlogbeat/docs/fields.asciidoc b/winlogbeat/docs/fields.asciidoc index 03e35a17065b..bb826805f3f3 100644 --- a/winlogbeat/docs/fields.asciidoc +++ b/winlogbeat/docs/fields.asciidoc @@ -130,6 +130,12 @@ Name of the cloud provider. Possible values are ec2, gce, or digitalocean. Instance ID of the host machine. +[float] +=== meta.cloud.instance_name + +Instance name of the host machine. + + [float] === meta.cloud.machine_type