From 7eed2ffbfc31896c00b6e165636b38c88fc51324 Mon Sep 17 00:00:00 2001 From: Jaime Soriano Pastor Date: Thu, 27 Aug 2020 18:08:45 +0200 Subject: [PATCH] Add missing country_name geo field in add host metadata (#20811) (#20817) Add `country_name` to the list of geo fields that can be added with `add_host_metadata` and `add_observer_metadata`. (cherry picked from commit 795c86f8a5331815e8a6cb76cc78c6b150931b6f) --- 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 846ddbde2b4..4cb75155e56 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -52,6 +52,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d - Fix `setup.dashboards.index` setting not working. {pull}17749[17749] - Fix Elasticsearch license endpoint URL referenced in error message. {issue}17880[17880] {pull}18030[18030] - Change `decode_json_fields` processor, to merge parsed json objects with existing objects in the event instead of fully replacing them. {pull}17958[17958] +- Add missing country_name geo field in `add_host_metadata` and `add_observer_metadata` processors. {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 500fc4ba9d8..a9227112577 100644 --- a/libbeat/processors/add_host_metadata/add_host_metadata_test.go +++ b/libbeat/processors/add_host_metadata/add_host_metadata_test.go @@ -153,6 +153,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 69de476b7fd..3932d193d78 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 48d39780d22..f37a4b7bc97 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,