diff --git a/metricbeat/docs/fields.asciidoc b/metricbeat/docs/fields.asciidoc index 63346f9b198..7c3b9b5adc2 100644 --- a/metricbeat/docs/fields.asciidoc +++ b/metricbeat/docs/fields.asciidoc @@ -31086,7 +31086,7 @@ type: keyword -- [[exported-fields-enterprisesearch]] -== enterprisesearch fields +== Enterprise Search fields Enterprise Search module @@ -31099,21 +31099,21 @@ Enterprise Search module -[float] -=== health - -Enterprise Search health - - -*`enterprisesearch.health.cluster_uuid`*:: +*`enterprisesearch.cluster_uuid`*:: + -- -Elasticsearch Cluster UUID used by Enterprise Search +Cluster UUID for the Elasticsearch cluster used as the data store for Enterprise Search. type: keyword -- +[float] +=== health + +Enterprise Search health + + *`enterprisesearch.health.name`*:: + -- @@ -31885,6 +31885,51 @@ type: long -- +[float] +=== product_usage + +Aggregate product usage statistics for the Enterprise Search deployment. + + +[float] +=== app_search + +App Search product usage statistics. + + +*`enterprisesearch.stats.product_usage.app_search.total_engines`*:: ++ +-- +Current number of App Search engines within the deployment. + +type: long + +-- + +[float] +=== workplace_search + +Workplace Search product usage statistics. + + +*`enterprisesearch.stats.product_usage.workplace_search.total_org_sources`*:: ++ +-- +Current number of Workplace Search org-wide content sources within the deployment. + +type: long + +-- + +*`enterprisesearch.stats.product_usage.workplace_search.total_private_sources`*:: ++ +-- +Current number of Workplace Search private content sources within the deployment. + +type: long + +-- + [[exported-fields-envoyproxy]] == Envoyproxy fields diff --git a/metricbeat/docs/modules/enterprisesearch.asciidoc b/metricbeat/docs/modules/enterprisesearch.asciidoc index d2998c5984d..1f34a3158f1 100644 --- a/metricbeat/docs/modules/enterprisesearch.asciidoc +++ b/metricbeat/docs/modules/enterprisesearch.asciidoc @@ -6,7 +6,7 @@ This file is generated! See scripts/mage/docs_collector.go [[metricbeat-module-enterprisesearch]] [role="xpack"] -== enterprisesearch module +== Enterprise Search module beta[] @@ -24,7 +24,7 @@ The Enterprise Search module requires a set of credentials (a username and a pas [float] === Example configuration -The enterprisesearch module supports the standard configuration options that are described +The Enterprise Search module supports the standard configuration options that are described in <>. Here is an example configuration: [source,yaml] diff --git a/metricbeat/docs/modules/enterprisesearch/health.asciidoc b/metricbeat/docs/modules/enterprisesearch/health.asciidoc index 1961fa3e1b4..bdf91e46c66 100644 --- a/metricbeat/docs/modules/enterprisesearch/health.asciidoc +++ b/metricbeat/docs/modules/enterprisesearch/health.asciidoc @@ -4,7 +4,7 @@ This file is generated! See scripts/mage/docs_collector.go [[metricbeat-metricset-enterprisesearch-health]] [role="xpack"] -=== enterprisesearch health metricset +=== Enterprise Search health metricset beta[] diff --git a/metricbeat/docs/modules/enterprisesearch/stats.asciidoc b/metricbeat/docs/modules/enterprisesearch/stats.asciidoc index 309e8ff45a1..df25f07a273 100644 --- a/metricbeat/docs/modules/enterprisesearch/stats.asciidoc +++ b/metricbeat/docs/modules/enterprisesearch/stats.asciidoc @@ -4,7 +4,7 @@ This file is generated! See scripts/mage/docs_collector.go [[metricbeat-metricset-enterprisesearch-stats]] [role="xpack"] -=== enterprisesearch stats metricset +=== Enterprise Search stats metricset beta[] diff --git a/metricbeat/docs/modules_list.asciidoc b/metricbeat/docs/modules_list.asciidoc index 4892eff3fab..7ddd229aff5 100644 --- a/metricbeat/docs/modules_list.asciidoc +++ b/metricbeat/docs/modules_list.asciidoc @@ -107,7 +107,7 @@ This file is generated! See scripts/mage/docs_collector.go |<> |<> |<> -|<> beta[] |image:./images/icon-yes.png[Prebuilt dashboards are available] | +|<> beta[] |image:./images/icon-yes.png[Prebuilt dashboards are available] | .2+| .2+| |<> beta[] |<> beta[] |<> |image:./images/icon-no.png[No prebuilt dashboards] | diff --git a/x-pack/metricbeat/metricbeat.reference.yml b/x-pack/metricbeat/metricbeat.reference.yml index cc078f59c89..f4e9c689bd6 100644 --- a/x-pack/metricbeat/metricbeat.reference.yml +++ b/x-pack/metricbeat/metricbeat.reference.yml @@ -513,7 +513,7 @@ metricbeat.modules: #xpack.enabled: false #scope: node -#--------------------------- Enterprisesearch Module --------------------------- +#-------------------------- Enterprise Search Module -------------------------- - module: enterprisesearch metricsets: ["health", "stats"] enabled: true diff --git a/x-pack/metricbeat/module/enterprisesearch/_meta/fields.yml b/x-pack/metricbeat/module/enterprisesearch/_meta/fields.yml index a5a13815042..abe269d31b1 100644 --- a/x-pack/metricbeat/module/enterprisesearch/_meta/fields.yml +++ b/x-pack/metricbeat/module/enterprisesearch/_meta/fields.yml @@ -1,5 +1,5 @@ - key: enterprisesearch - title: "enterprisesearch" + title: "Enterprise Search" release: beta settings: ["ssl", "http"] description: > @@ -10,3 +10,6 @@ description: > `enterprisesearch` contains metrics and health information for Enterprise Search fields: + - name: cluster_uuid + type: keyword + description: Cluster UUID for the Elasticsearch cluster used as the data store for Enterprise Search. diff --git a/x-pack/metricbeat/module/enterprisesearch/fields.go b/x-pack/metricbeat/module/enterprisesearch/fields.go index fe2c00a8b16..16e172b5c45 100644 --- a/x-pack/metricbeat/module/enterprisesearch/fields.go +++ b/x-pack/metricbeat/module/enterprisesearch/fields.go @@ -19,5 +19,5 @@ func init() { // AssetEnterprisesearch returns asset data. // This is the base64 encoded zlib format compressed contents of module/enterprisesearch. func AssetEnterprisesearch() string { - return "eJzsm91v3LgRwN/9Vwz81AK1i/t68cMBadIiOTTBAfH1HopCR5GzK2YlUuFQa+/99QVJSavVlyWt1i561kMQrNczv/ngzJCib2CHhztAZdHkRhISMsOTKwArbYp3cN3+0fUVgMEUGeEdxGjZFQChtVJt6Q7+fU2UXv8FrhNr8+v/XAEIJG5kbqVWd/DjFQDA32uR8NnLhEyLIsUrgI3EVNCd/9oNKJZhL5x77CHHO9gaXeTlJz2q3PNbW8BvwLWyTCqCDK2RnIApAQmy1CYg1UabjDkpsNGmS1sKbqI2cYOY+uM+UPe0fVg9J0Z0PdWR3sZoovC0IIsmKgopTr5QQe3w8KBN+2enCCkjK3nwHLwNEuGXXz68g4JQQHwY9BBAL5X7dynNe03WC/ChsQn2uEhpgeMEezQkteqFaMdpQkxKcc3MaQnoC9KJS4osRtP58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k/wQejSuEl6X9h2AEjCKLBadd0xAGprpCinxz87sAp8Pgv7iHae4CzJ5HGsWtb3OklTqQq6k8HtOsQpVdcH10tOI3G1RkiZeMboUKNFIpJm/y9wP9XyN/4JBPkn4Yeb82Z8yqrisdI0rNm+VS4ZIYPF74G+MzLLQleZ7rvuY/pFg6utNu4ECbvqA5dnFFIuZCbjLlysjasIzhZi7qj4YIRhQDhht+2GJ2itiQwmLnVd8BWqI7/pUUOjkLL8nqYDVco9GQK7lGAf5RYr4Ln9FhV+2cTM30r57nacqS/Us9MzUsuOB6hQy23KyAOK+xQNZaUSam1NcvoubrK6n55kXUfHMlNd++iJpvr6TmuxdR891Mao5OgibeuznUK//MFWR4GrywwhdatwOuYXJC186cYOGkoD4J8rczeIUFF+gF8sQvWcZu41EsucCMoTZK7lA9dl20Hf4bu9MhijUggw0n4UHuiecQ3BnWl5Lw4pZCgr/Z8GsHmb8BeTsVR25nE7NwsWHXUtEcmNYXK4KzwH5mIldKMktN8mc6o+dzbSz8Uifqpnt+XsqwKuSudLubkROWVFWmj3+0NgS9jV9V0Y+Fk/zjeqTjI9Qwu9Od6pmKf+bYLQKvnTTF0P8LA4nAdsZy21yNmSWirYs288T1NLJSLTMtraLTDz/ORLglRKrlw5Yz9P8chfts7X904NtqKsU3xOCtFdVuhwr6TwAAAP//L5rceg==" } diff --git a/x-pack/metricbeat/module/enterprisesearch/health/_meta/docs.asciidoc b/x-pack/metricbeat/module/enterprisesearch/health/_meta/docs.asciidoc index d5c89fd693d..49bacfa6814 100644 --- a/x-pack/metricbeat/module/enterprisesearch/health/_meta/docs.asciidoc +++ b/x-pack/metricbeat/module/enterprisesearch/health/_meta/docs.asciidoc @@ -1,3 +1,3 @@ -This is the health metricset of the module enterprisesearch. +This is the `health` metricset of the Enterprise Search module. This metricset allows users to fetch and ingest Enterprise Search solution health information from the https://www.elastic.co/guide/en/enterprise-search/current/monitoring-apis.html#health-api[Health API]. diff --git a/x-pack/metricbeat/module/enterprisesearch/health/_meta/fields.yml b/x-pack/metricbeat/module/enterprisesearch/health/_meta/fields.yml index d3ad2d909c0..41038696c9f 100644 --- a/x-pack/metricbeat/module/enterprisesearch/health/_meta/fields.yml +++ b/x-pack/metricbeat/module/enterprisesearch/health/_meta/fields.yml @@ -3,10 +3,6 @@ release: beta description: Enterprise Search health fields: - - name: cluster_uuid - type: keyword - description: Elasticsearch Cluster UUID used by Enterprise Search - - name: name type: keyword description: Host name for the Enterprise Search node diff --git a/x-pack/metricbeat/module/enterprisesearch/health/_meta/testdata/health.json-expected.json b/x-pack/metricbeat/module/enterprisesearch/health/_meta/testdata/health.json-expected.json index 78c1c20fac9..2ec21d12edc 100644 --- a/x-pack/metricbeat/module/enterprisesearch/health/_meta/testdata/health.json-expected.json +++ b/x-pack/metricbeat/module/enterprisesearch/health/_meta/testdata/health.json-expected.json @@ -1,8 +1,8 @@ [ { "enterprisesearch": { + "cluster_uuid": "MTD6fXYGTZylTMoW5AG5JA", "health": { - "cluster_uuid": "MTD6fXYGTZylTMoW5AG5JA", "crawler": { "workers": { "active": 0, diff --git a/x-pack/metricbeat/module/enterprisesearch/health/data.go b/x-pack/metricbeat/module/enterprisesearch/health/data.go index bf8de2fdee5..517b0d1fbbc 100644 --- a/x-pack/metricbeat/module/enterprisesearch/health/data.go +++ b/x-pack/metricbeat/module/enterprisesearch/health/data.go @@ -13,12 +13,12 @@ import ( "github.com/elastic/beats/v7/libbeat/common" s "github.com/elastic/beats/v7/libbeat/common/schema" c "github.com/elastic/beats/v7/libbeat/common/schema/mapstriface" + "github.com/elastic/beats/v7/metricbeat/mb" ) var ( schema = s.Schema{ - "cluster_uuid": c.Str("cluster_uuid"), // This is going to be included in 7.16+ - "name": c.Str("name"), + "name": c.Str("name"), "version": c.Dict("version", s.Schema{ "number": c.Str("number"), @@ -73,14 +73,21 @@ var ( } ) -func eventMapping(input []byte) (common.MapStr, error) { +func eventMapping(report mb.ReporterV2, input []byte) error { var data map[string]interface{} err := json.Unmarshal(input, &data) if err != nil { - return nil, err + return err } var errs multierror.Errors + // All events need to have a cluster_uuid to work with Stack Monitoring + event := mb.Event{ + ModuleFields: common.MapStr{}, + MetricSetFields: common.MapStr{}, + } + event.ModuleFields.Put("cluster_uuid", data["cluster_uuid"]) + // Collect process info in a form ready for mapping process := make(map[string]interface{}) process["filebeat"] = data["filebeat"] @@ -108,10 +115,12 @@ func eventMapping(input []byte) (common.MapStr, error) { // Set the process info we have collected data["process"] = process - dataFields, err := schema.Apply(data) + event.MetricSetFields, err = schema.Apply(data) if err != nil { errs = append(errs, errors.Wrap(err, "failure to apply health schema")) + } else { + report.Event(event) } - return dataFields, errs.Err() + return errs.Err() } diff --git a/x-pack/metricbeat/module/enterprisesearch/health/health.go b/x-pack/metricbeat/module/enterprisesearch/health/health.go index 065ab592666..e649748c2b7 100644 --- a/x-pack/metricbeat/module/enterprisesearch/health/health.go +++ b/x-pack/metricbeat/module/enterprisesearch/health/health.go @@ -63,12 +63,10 @@ func (m *MetricSet) Fetch(report mb.ReporterV2) error { return errors.Wrap(err, "error in fetch") } - event, err := eventMapping(content) + err = eventMapping(report, content) if err != nil { return errors.Wrap(err, "error converting event") } - report.Event(mb.Event{MetricSetFields: event}) - return nil } diff --git a/x-pack/metricbeat/module/enterprisesearch/stats/_meta/docs.asciidoc b/x-pack/metricbeat/module/enterprisesearch/stats/_meta/docs.asciidoc index 226c1d2e494..90fdec57ccf 100644 --- a/x-pack/metricbeat/module/enterprisesearch/stats/_meta/docs.asciidoc +++ b/x-pack/metricbeat/module/enterprisesearch/stats/_meta/docs.asciidoc @@ -1,3 +1,3 @@ -This is the stats metricset of the module enterprisesearch. +This is the `stats` metricset of the Enterprise Search module. This metricset allows users to fetch and ingest Enterprise Search solution statistics information from the https://www.elastic.co/guide/en/enterprise-search/current/monitoring-apis.html#stats-api[Stats API]. diff --git a/x-pack/metricbeat/module/enterprisesearch/stats/_meta/fields.yml b/x-pack/metricbeat/module/enterprisesearch/stats/_meta/fields.yml index 2e014de7c7b..606d94514e3 100644 --- a/x-pack/metricbeat/module/enterprisesearch/stats/_meta/fields.yml +++ b/x-pack/metricbeat/module/enterprisesearch/stats/_meta/fields.yml @@ -18,7 +18,7 @@ - name: working type: long description: Number of connectors jobs currently being processed. - + - name: job_types type: group description: Breakdown of connectors jobs by types. @@ -218,7 +218,7 @@ - name: engine_destroyer.count type: long description: Total number of jobs processed via the engine_destroyer queue since the start of the instance. - + - name: mailer.count type: long description: Total number of jobs processed via the mailer queue since the start of the instance. @@ -226,7 +226,31 @@ - name: process_crawl.count type: long description: Total number of jobs processed via the process_crawl queue since the start of the instance. - + - name: failed.count type: long description: Total number of jobs waiting in the failed queue. + + - name: product_usage + type: group + description: Aggregate product usage statistics for the Enterprise Search deployment. + fields: + - name: app_search + type: group + description: App Search product usage statistics. + fields: + - name: total_engines + type: long + description: Current number of App Search engines within the deployment. + + - name: workplace_search + type: group + description: Workplace Search product usage statistics. + fields: + - name: total_org_sources + type: long + description: Current number of Workplace Search org-wide content sources within the deployment. + + - name: total_private_sources + type: long + description: Current number of Workplace Search private content sources within the deployment. diff --git a/x-pack/metricbeat/module/enterprisesearch/stats/_meta/testdata/stats.json b/x-pack/metricbeat/module/enterprisesearch/stats/_meta/testdata/stats.json index 42c375323d7..d042f260364 100644 --- a/x-pack/metricbeat/module/enterprisesearch/stats/_meta/testdata/stats.json +++ b/x-pack/metricbeat/module/enterprisesearch/stats/_meta/testdata/stats.json @@ -1,4 +1,5 @@ { + "cluster_uuid": "s7QHFAuAQmqeqnGZmAqXIA", "http": { "connections": { "current": 1, diff --git a/x-pack/metricbeat/module/enterprisesearch/stats/_meta/testdata/stats.json-expected.json b/x-pack/metricbeat/module/enterprisesearch/stats/_meta/testdata/stats.json-expected.json index 7312eed7c6d..ca69493d341 100644 --- a/x-pack/metricbeat/module/enterprisesearch/stats/_meta/testdata/stats.json-expected.json +++ b/x-pack/metricbeat/module/enterprisesearch/stats/_meta/testdata/stats.json-expected.json @@ -1,6 +1,7 @@ [ { "enterprisesearch": { + "cluster_uuid": "s7QHFAuAQmqeqnGZmAqXIA", "stats": { "connectors": { "job_store": { @@ -75,6 +76,15 @@ "5xx": 5 } }, + "product_usage": { + "app_search": { + "total_engines": 1 + }, + "workplace_search": { + "total_org_sources": 2, + "total_private_sources": 3 + } + }, "queues": { "engine_destroyer": { "count": 1 diff --git a/x-pack/metricbeat/module/enterprisesearch/stats/data.go b/x-pack/metricbeat/module/enterprisesearch/stats/data.go index 7a8f90d04be..45541fda1ad 100644 --- a/x-pack/metricbeat/module/enterprisesearch/stats/data.go +++ b/x-pack/metricbeat/module/enterprisesearch/stats/data.go @@ -13,6 +13,7 @@ import ( "github.com/elastic/beats/v7/libbeat/common" s "github.com/elastic/beats/v7/libbeat/common/schema" c "github.com/elastic/beats/v7/libbeat/common/schema/mapstriface" + "github.com/elastic/beats/v7/metricbeat/mb" ) var ( @@ -84,17 +85,34 @@ var ( }), }), }), + + "product_usage": c.Dict("product_usage", s.Schema{ + "app_search": c.Dict("app_search", s.Schema{ + "total_engines": c.Int("total_engines"), + }), + "workplace_search": c.Dict("workplace_search", s.Schema{ + "total_org_sources": c.Int("total_org_sources"), + "total_private_sources": c.Int("total_private_sources"), + }), + }), } ) -func eventMapping(input []byte) (common.MapStr, error) { +func eventMapping(report mb.ReporterV2, input []byte) error { var data map[string]interface{} err := json.Unmarshal(input, &data) if err != nil { - return nil, err + return err } var errs multierror.Errors + // All events need to have a cluster_uuid to work with Stack Monitoring + event := mb.Event{ + ModuleFields: common.MapStr{}, + MetricSetFields: common.MapStr{}, + } + event.ModuleFields.Put("cluster_uuid", data["cluster_uuid"]) + // Get queues information queues, ok := data["queues"].(map[string]interface{}) if ok { @@ -110,9 +128,12 @@ func eventMapping(input []byte) (common.MapStr, error) { errs = append(errs, errors.New("queues is not a map")) } - dataFields, err := schema.Apply(data) + event.MetricSetFields, err = schema.Apply(data) if err != nil { errs = append(errs, errors.Wrap(err, "failure to apply stats schema")) + } else { + report.Event(event) } - return dataFields, errs.Err() + + return errs.Err() } diff --git a/x-pack/metricbeat/module/enterprisesearch/stats/stats.go b/x-pack/metricbeat/module/enterprisesearch/stats/stats.go index e204944c12d..8a1f2036235 100644 --- a/x-pack/metricbeat/module/enterprisesearch/stats/stats.go +++ b/x-pack/metricbeat/module/enterprisesearch/stats/stats.go @@ -63,11 +63,10 @@ func (m *MetricSet) Fetch(report mb.ReporterV2) error { return errors.Wrap(err, "error in fetch") } - event, err := eventMapping(content) + err = eventMapping(report, content) if err != nil { return errors.Wrap(err, "error converting event") } - report.Event(mb.Event{MetricSetFields: event}) return nil }