From 7660ff3072678bfc3d337414d9f5a494d3359466 Mon Sep 17 00:00:00 2001 From: Jaime Soriano Pastor Date: Wed, 26 Aug 2020 23:14:19 +0200 Subject: [PATCH 1/2] Add missing country_name geo field Add `country_name` to the list of geo fields that can be added with `add_host_metadata` and `add_observer_metadata`. --- CHANGELOG.next.asciidoc | 1 + libbeat/processors/add_host_metadata/add_host_metadata_test.go | 1 + .../add_observer_metadata/add_observer_metadata_test.go | 1 + libbeat/processors/util/geo.go | 2 ++ 4 files changed, 5 insertions(+) diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index 7457b93ed851..87eaaa3839ef 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -165,6 +165,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d - Log debug message if the Kibana dashboard can not be imported from the archive because of the invalid archive directory structure {issue}12211[12211], {pull}13387[13387] - Add service resource in k8s cluster role. {pull}20546[20546] - [Metricbeat][Kubernetes] Change cluster_ip field from ip to keyword. {pull}20571[20571] +- Add missing country_name geo field in `add_host_metadata`. {issue}20796[20796] {pull}20811[20811] *Auditbeat* diff --git a/libbeat/processors/add_host_metadata/add_host_metadata_test.go b/libbeat/processors/add_host_metadata/add_host_metadata_test.go index 158cc28cfbc9..22efa5270262 100644 --- a/libbeat/processors/add_host_metadata/add_host_metadata_test.go +++ b/libbeat/processors/add_host_metadata/add_host_metadata_test.go @@ -158,6 +158,7 @@ func TestConfigGeoEnabled(t *testing.T) { "geo.name": "yerevan-am", "geo.location": "40.177200, 44.503490", "geo.continent_name": "Asia", + "geo.country_name": "Armenia", "geo.country_iso_code": "AM", "geo.region_name": "Erevan", "geo.region_iso_code": "AM-ER", diff --git a/libbeat/processors/add_observer_metadata/add_observer_metadata_test.go b/libbeat/processors/add_observer_metadata/add_observer_metadata_test.go index 69de476b7fd3..3932d193d782 100644 --- a/libbeat/processors/add_observer_metadata/add_observer_metadata_test.go +++ b/libbeat/processors/add_observer_metadata/add_observer_metadata_test.go @@ -120,6 +120,7 @@ func TestConfigGeoEnabled(t *testing.T) { "geo.name": "yerevan-am", "geo.location": "40.177200, 44.503490", "geo.continent_name": "Asia", + "geo.country_name": "Armenia", "geo.country_iso_code": "AM", "geo.region_name": "Erevan", "geo.region_iso_code": "AM-ER", diff --git a/libbeat/processors/util/geo.go b/libbeat/processors/util/geo.go index 48d39780d22a..f37a4b7bc97f 100644 --- a/libbeat/processors/util/geo.go +++ b/libbeat/processors/util/geo.go @@ -29,6 +29,7 @@ type GeoConfig struct { Name string `config:"name"` Location string `config:"location"` ContinentName string `config:"continent_name"` + CountryName string `config:"country_name"` CountryISOCode string `config:"country_iso_code"` RegionName string `config:"region_name"` RegionISOCode string `config:"region_iso_code"` @@ -59,6 +60,7 @@ func GeoConfigToMap(config GeoConfig) (common.MapStr, error) { "name": config.Name, "location": config.Location, "continent_name": config.ContinentName, + "country_name": config.CountryName, "country_iso_code": config.CountryISOCode, "region_name": config.RegionName, "region_iso_code": config.RegionISOCode, From 12d1bdf39d14c43e27c3ffc75d61e06b2ec0d7d1 Mon Sep 17 00:00:00 2001 From: Jaime Soriano Pastor Date: Wed, 26 Aug 2020 23:36:54 +0200 Subject: [PATCH 2/2] Add add_observer_metadata to the changelog --- CHANGELOG.next.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index 87eaaa3839ef..3d5e607aff6f 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -165,7 +165,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d - Log debug message if the Kibana dashboard can not be imported from the archive because of the invalid archive directory structure {issue}12211[12211], {pull}13387[13387] - Add service resource in k8s cluster role. {pull}20546[20546] - [Metricbeat][Kubernetes] Change cluster_ip field from ip to keyword. {pull}20571[20571] -- Add missing country_name geo field in `add_host_metadata`. {issue}20796[20796] {pull}20811[20811] +- Add missing country_name geo field in `add_host_metadata` and `add_observer_metadata` processors. {issue}20796[20796] {pull}20811[20811] *Auditbeat*