Elasticsearch receiver
The Elasticsearch receiver queries the Elasticsearch node stats, cluster health and index stats endpoints in order to scrape metrics from a running Elasticsearch cluster.
The Elasticsearch receiver queries Elasticsearch’s node stats, cluster health and index stats endpoints to scrape metrics from a running Elasticsearch cluster. The supported pipeline type is metrics. See Process your data with pipelines for more information.
To learn more about the queried endpoints, see the following topics in the Elastic documentation:
Prerequisites
This receiver supports Elasticsearch versions 7.9 or higher.
If Elasticsearch security features are enabled, you must have either the monitor or manage cluster privilege. See https://www.elastic.co/guide/en/elasticsearch/reference/current/authorization.html for role-based access control and https://www.elastic.co/guide/en/elasticsearch/reference/current/security-privileges.html for security privileges in the Elastic documentation for more information.
Deploy the collector
See Deploy the Splunk Distribution of the OpenTelemetry Collector.
Configure the receiver
Edit your OpenTelemetry Collector configuration file as follows.
-
Add
elasticsearchto thereceiverssection of your configuration file:CODEreceivers: elasticsearch: metrics: elasticsearch.node.fs.disk.available: enabled: false nodes: ["_local"] skip_cluster_metrics: true indices: [".geoip_databases"] endpoint: http://localhost:9200 username: otel password: password collection_interval: 10s -
Include the receiver in the
metricspipeline of theservicesection of your configuration file:CODEservice: pipelines: metrics: receivers: - elasticsearch
Advanced configurations
- Optional settings
-
The following settings are optional:
-
nodes.["_all"]by default. Allows you to specify node filters that define which nodes are scraped for node-level and cluster-level metrics.-
For allowed filters, see the Cluster APIs Node specification at https://www.elastic.co/guide/en/elasticsearch/reference/7.9/cluster.html#cluster-nodes in the Elastic documentation.
-
If empty, then the receiver doesn’t scrape any node-level metrics, and only metrics related to the cluster’s health are scraped at the cluster level.
-
-
skip_cluster_metrics.falseby default. Iftrue, cluster-level metrics are not scraped. -
indices.["_all"]by default. Allows you to specify index filters that define which indices are scraped for index-level metrics.-
For allowed filters, see Cluster APIs Path parameters at https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-stats.html#index-stats-api-path-params in the Elastic documentation.
-
If empty, then the receiver doesn’t scrape any index-level metrics.
-
-
endpoint.http://localhost:9200by default. The base URL of the Elasticsearch API for the cluster to monitor. -
username. No default. Specifies the username used to authenticate with Elasticsearch using basic auth. -
password. No default. Specifies the password used to authenticate with Elasticsearch using basic auth. -
collection_interval.10sby default. This receiver collects metrics on an interval determined by this setting. This value must be a string readable by Golang’s time.ParseDuration. See https://pkg.go.dev/time#ParseDuration.-
On larger clusters, you might need to increase this interval, as querying Elasticsearch for metrics takes longer on clusters with more nodes.
-
-
initial_delay.1sby default. Defines how long this receiver waits before starting.
-
-
Activate or deactivate specific metrics
You can activate or deactivate specific metrics by setting the
enabledfield in themetricssection for each metric. For example:YAMLreceivers: samplereceiver: metrics: metric-one: enabled: true metric-two: enabled: falseThe following is an example of host metrics receiver configuration with activated metrics:
YAMLreceivers: hostmetrics: scrapers: process: metrics: process.cpu.utilization: enabled: trueNote: Deactivated metrics aren’t sent to Splunk Observability Cloud.Billing-
If you’re in a MTS-based subscription, all metrics count towards metrics usage.
-
If you’re in a host-based plan, metrics listed as active (Active: Yes) on this document are considered default and are included free of charge.
Learn more at Infrastructure Monitoring subscription usage (Host and metric plans).
-
Restart the collector
The restart command varies depending on what platform you deployed the collector on and what tool you used to deploy it. Here are general examples of the restart command:
- Linux
-
BASH
sudo systemctl restart splunk-otel-collector - Windows
-
Windows with installer script:
BASHstop-service splunk-otel-collector start-service splunk-otel-collector - Kubernetes
-
BASH
helm upgrade your-splunk-otel-collector splunk-otel-collector-chart/splunk-otel-collector -f your-override-values.yamlwhere
splunk-otel-collector-chartis the name you gave to the Helm chart in thehelm repo addcommand.
Settings reference
The following table shows the configuration options for the Elasticsearch receiver:
included
https://raw.githubusercontent.com/splunk/collector-config-tools/main/cfg-metadata/receiver/elasticsearch.yaml
Metrics reference
The following metrics, resource attributes, and attributes, are available.
Metric availability:
The following metrics are available with versions:
-
elasticsearch.indexing_pressure.memory.limit. Available in versions 7.10 or higher. -
elasticsearch.node.shards.data_set.size. Available in versions 7.13 or higher. -
elasticsearch.cluster.state_update.count. Available in versions 7.16.0 or higher. -
elasticsearch.cluster.state_update.time. Available in versions 7.16.0 or higher.
included
https://raw.githubusercontent.com/splunk/collector-config-tools/main/metric-metadata/elasticsearchreceiver.yaml