---
title: "Apache Solr integration | Grafana Cloud documentation"
description: "Learn about Apache Solr Grafana Cloud integration."
---

> For a curated documentation index, see [llms.txt](/llms.txt). For the complete documentation index, see [llms-full.txt](/llms-full.txt).

# Apache Solr integration for Grafana Cloud

Apache Solr is an open-source search platform built on Apache Lucene, known for its powerful full-text search, scalability, and real-time indexing capabilities. It supports a wide range of document formats and offers features like faceted search, geospatial search, and rich document handling. The integration with Grafana Cloud enables users to oversee a Solr environment using distinct dashboards. These dashboards display metrics and logs for Solr clusters, query performance, resource monitoring, and logs.

This integration supports Apache Solr 8.11.2 and uses the built-in Prometheus exporter.

This integration includes 8 useful alerts and 4 pre-built dashboards to help monitor and visualize Apache Solr metrics and logs.

## Before you begin

For the integration to work properly, you must run the built-in Prometheus exporter on each cluster instance. For more information, refer to [Monitoring Solr with Prometheus and Grafana](https://solr.apache.org/guide/8_11/monitoring-solr-with-prometheus-and-grafana.html) in the Apache Solr Reference Guide.

### Initiating the Prometheus Exporter

Initiate the Prometheus Exporter in Apache Solr either in a Standalone or SolrCloud mode by navigating to `contrib/prometheus-exporter` on your Solr instance and applying relevant [command line parameters](https://solr.apache.org/guide/8_11/monitoring-solr-with-prometheus-and-grafana.html#command-line-parameters) as demonstrated below.

For Linux, initiate the Prometheus Exporter in SolrCloud mode with:  
`./bin/solr-exporter -p 9854 -z localhost:2181/solr -f ./conf/solr-exporter-config.xml -n 16`

For Windows, initiate the Prometheus Exporter in SolrCloud mode with:  
`.\bin\solr-exporter -p 9854 -z localhost:2181/solr -f .\conf\solr-exporter-config.xml -n 16`

In cases where SolrCloud mode operates with a ZooKeeper ensemble, set the `-z` zkhost value as a string zk1,zk2,zk3.

### Validate the Prometheus Exporter

Upon activation, the Prometheus Exporter reports the metrics. The full metric list is shown when there is an active ZooKeeper ensemble setup and a Solr Collection created. To validate that the Prometheus Exporter is set up correctly, the Prometheus metrics are accessible locally with curl:

sh ![Copy code to clipboard](https://grafana.com/media/images/icons/icon-copy-small-2.svg) Copy

```sh
curl http://localhost:9854/metrics
```

### Configure logs location

No additional configuration is required for the collection of Apache Solr logs. By default, logs are written to the `SOLR_LOGS_DIR`, located at `/var/solr/logs` on Linux or `server/logs` on Windows.

## Install Apache Solr integration for Grafana Cloud

1. In your Grafana Cloud stack, click **Connections** in the left-hand menu.
2. Find **Apache Solr** and click its tile to open the integration.
3. Review the prerequisites in the **Configuration Details** tab and set up Grafana Alloy to send Apache Solr metrics and logs to your Grafana Cloud instance.
4. Click **Install** to add this integration’s pre-built dashboards and alerts to your Grafana Cloud instance, and you can start monitoring your Apache Solr setup.

## Configuration snippets for Grafana Alloy

### Advanced mode

The following snippets provide examples to guide you through the configuration process.

To instruct Grafana Alloy to scrape your Apache Solr instances, **manually** copy and append the snippets to your alloy configuration file, then follow subsequent instructions.

### Advanced metrics snippets

Alloy ![Copy code to clipboard](https://grafana.com/media/images/icons/icon-copy-small-2.svg) Copy

```alloy
prometheus.scrape "metrics_integrations_integrations_apache_solr" {
	targets = [{
		__address__  = "localhost:<your-instance-port>",
		solr_cluster = "<your-solr-cluster-name>",
	}]
	forward_to = [prometheus.remote_write.metrics_service.receiver]
	job_name   = "integrations/apache-solr"
}
```

To monitor your Apache Solr instance, you use a [prometheus.scrape](https://grafana.com/docs/alloy/latest/reference/components/prometheus.scrape/) component to scrape your Apache Solr Prometheus metrics endpoint.

Configure the following properties within the `targets` list of the `prometheus.scrape` component:

- `__address__`: The address to your Apache Solr Prometheus metrics endpoint.
- `solr_cluster` label: This value must identify the Solr cluster this instance belongs to. Use the `cluster_id` label generated by the Prometheus exporter, or specify a custom value for this label.

If you have multiple Apache Solr servers to scrape, add a target for each one to the `targets` list in the `prometheus.scrape` component.

### Advanced logs snippets

#### darwin

Alloy ![Copy code to clipboard](https://grafana.com/media/images/icons/icon-copy-small-2.svg) Copy

```alloy
local.file_match "logs_integrations_integrations_apache_solr" {
	path_targets = [{
		__address__  = "localhost",
		__path__     = "/var/solr/logs/*.log",
		instance     = constants.hostname,
		job          = "integrations/apache-solr",
		solr_cluster = "<your-solr-cluster-name>",
	}]
}

loki.process "logs_integrations_integrations_apache_solr" {
	forward_to = [loki.write.grafana_cloud_loki.receiver]

	stage.multiline {
		firstline     = "^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}\\.\\d{3}"
		max_lines     = 0
		max_wait_time = "3s"
	}

	stage.regex {
		expression = "^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}\\.\\d{3} (?P<level>\\w+)"
	}

	stage.labels {
		values = {
			level = null,
		}
	}
}

loki.source.file "logs_integrations_integrations_apache_solr" {
	targets    = local.file_match.logs_integrations_integrations_apache_solr.targets
	forward_to = [loki.process.logs_integrations_integrations_apache_solr.receiver]
}
```

To monitor your Apache Solr instance logs, you use a combination of the following components:

- [local.file\_match](https://grafana.com/docs/alloy/latest/reference/components/local.file_match/) defines where to find the log file to be scraped. Change the following properties according to your environment:
  
  - `__address__`: The Apache Solr instance address
  - `__path__`: The Solr logs location, or where `SOLR_LOGS_DIR` is set. By default, this value is `/var/solr/logs/*.log` on Linux or `server/logs/*.log` on Windows.
  - `instance` label: `constants.hostname` sets the `instance` label to your Grafana Alloy server hostname. If that is not suitable, change it to a value uniquely identifies this Apache Solr instance. Make sure this label value is the same for all telemetry data collected for this instance.
  - `solr_cluster` label: This value must identify the Solr cluster this instance belongs to. Use the `cluster_id` label generated by the Prometheus exporter, or specify a custom value for this label.
- [loki.process](https://grafana.com/docs/alloy/latest/reference/components/loki.process/) defines how to process logs before sending them to Loki.
- [loki.source.file](https://grafana.com/docs/alloy/latest/reference/components/loki.source.file/) reads the log entries from the files and forwards them to `loki.process`.

#### linux

Alloy ![Copy code to clipboard](https://grafana.com/media/images/icons/icon-copy-small-2.svg) Copy

```alloy
local.file_match "logs_integrations_integrations_apache_solr" {
	path_targets = [{
		__address__  = "localhost",
		__path__     = "/var/solr/logs/*.log",
		instance     = constants.hostname,
		job          = "integrations/apache-solr",
		solr_cluster = "<your-solr-cluster-name>",
	}]
}

loki.process "logs_integrations_integrations_apache_solr" {
	forward_to = [loki.write.grafana_cloud_loki.receiver]

	stage.multiline {
		firstline     = "^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}\\.\\d{3}"
		max_lines     = 0
		max_wait_time = "3s"
	}

	stage.regex {
		expression = "^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}\\.\\d{3} (?P<level>\\w+)"
	}

	stage.labels {
		values = {
			level = null,
		}
	}
}

loki.source.file "logs_integrations_integrations_apache_solr" {
	targets    = local.file_match.logs_integrations_integrations_apache_solr.targets
	forward_to = [loki.process.logs_integrations_integrations_apache_solr.receiver]
}
```

To monitor your Apache Solr instance logs, you use a combination of the following components:

- [local.file\_match](https://grafana.com/docs/alloy/latest/reference/components/local.file_match/) defines where to find the log file to be scraped. Change the following properties according to your environment:
  
  - `__address__`: The Apache Solr instance address
  - `__path__`: The Solr logs location, or where `SOLR_LOGS_DIR` is set. By default, this value is `/var/solr/logs/*.log` on Linux or `server/logs/*.log` on Windows.
  - `instance` label: `constants.hostname` sets the `instance` label to your Grafana Alloy server hostname. If that is not suitable, change it to a value uniquely identifies this Apache Solr instance. Make sure this label value is the same for all telemetry data collected for this instance.
  - `solr_cluster` label: This value must identify the Solr cluster this instance belongs to. Use the `cluster_id` label generated by the Prometheus exporter, or specify a custom value for this label.
- [loki.process](https://grafana.com/docs/alloy/latest/reference/components/loki.process/) defines how to process logs before sending them to Loki.
- [loki.source.file](https://grafana.com/docs/alloy/latest/reference/components/loki.source.file/) reads the log entries from the files and forwards them to `loki.process`.

#### windows

Alloy ![Copy code to clipboard](https://grafana.com/media/images/icons/icon-copy-small-2.svg) Copy

```alloy
local.file_match "logs_integrations_integrations_apache_solr" {
	path_targets = [{
		__address__  = "localhost",
		__path__     = "/var/solr/logs/*.log",
		instance     = constants.hostname,
		job          = "integrations/apache-solr",
		solr_cluster = "<your-solr-cluster-name>",
	}]
}

loki.process "logs_integrations_integrations_apache_solr" {
	forward_to = [loki.write.grafana_cloud_loki.receiver]

	stage.multiline {
		firstline     = "^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}\\.\\d{3}"
		max_lines     = 0
		max_wait_time = "3s"
	}

	stage.regex {
		expression = "^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}\\.\\d{3} (?P<level>\\w+)"
	}

	stage.labels {
		values = {
			level = null,
		}
	}
}

loki.source.file "logs_integrations_integrations_apache_solr" {
	targets    = local.file_match.logs_integrations_integrations_apache_solr.targets
	forward_to = [loki.process.logs_integrations_integrations_apache_solr.receiver]
}
```

To monitor your Apache Solr instance logs, you use a combination of the following components:

- [local.file\_match](https://grafana.com/docs/alloy/latest/reference/components/local.file_match/) defines where to find the log file to be scraped. Change the following properties according to your environment:
  
  - `__address__`: The Apache Solr instance address
  - `__path__`: The Solr logs location, or where `SOLR_LOGS_DIR` is set. By default, this value is `/var/solr/logs/*.log` on Linux or `server/logs/*.log` on Windows.
  - `instance` label: `constants.hostname` sets the `instance` label to your Grafana Alloy server hostname. If that is not suitable, change it to a value uniquely identifies this Apache Solr instance. Make sure this label value is the same for all telemetry data collected for this instance.
  - `solr_cluster` label: This value must identify the Solr cluster this instance belongs to. Use the `cluster_id` label generated by the Prometheus exporter, or specify a custom value for this label.
- [loki.process](https://grafana.com/docs/alloy/latest/reference/components/loki.process/) defines how to process logs before sending them to Loki.
- [loki.source.file](https://grafana.com/docs/alloy/latest/reference/components/loki.source.file/) reads the log entries from the files and forwards them to `loki.process`.

## Kubernetes instructions

Instructions for Kubernetes

### Before you begin with Kubernetes

**Note**: These instructions assume the use of the [Kubernetes Monitoring Helm chart](https://github.com/grafana/k8s-monitoring-helm/).

For the integration to work properly, you must run the built-in Prometheus exporter on each cluster instance. For more information, refer to [Monitoring Solr with Prometheus and Grafana](https://solr.apache.org/guide/8_11/monitoring-solr-with-prometheus-and-grafana.html) in the Apache Solr Reference Guide.

### Initiating the Prometheus Exporter

Initiate the Prometheus Exporter in Apache Solr either in a Standalone or SolrCloud mode by navigating to `contrib/prometheus-exporter` on your Solr instance and applying relevant [command line parameters](https://solr.apache.org/guide/8_11/monitoring-solr-with-prometheus-and-grafana.html#command-line-parameters) as demonstrated below.

For Linux, initiate the Prometheus Exporter in SolrCloud mode with:  
`./bin/solr-exporter -p 9854 -z localhost:2181/solr -f ./conf/solr-exporter-config.xml -n 16`

For Windows, initiate the Prometheus Exporter in SolrCloud mode with:  
`.\bin\solr-exporter -p 9854 -z localhost:2181/solr -f .\conf\solr-exporter-config.xml -n 16`

In cases where SolrCloud mode operates with a ZooKeeper ensemble, set the `-z` zkhost value as a string zk1,zk2,zk3.

### Validate the Prometheus Exporter

Upon activation, the Prometheus Exporter reports the metrics. The full metric list is shown when there is an active ZooKeeper ensemble setup and a Solr Collection created. To validate that the Prometheus Exporter is set up correctly, the Prometheus metrics are accessible locally with curl:

sh ![Copy code to clipboard](https://grafana.com/media/images/icons/icon-copy-small-2.svg) Copy

```sh
curl http://localhost:9854/metrics
```

### Configuration snippets for Kubernetes Helm chart

The following snippets provide examples to guide you through the configuration process.

To scrape your Apache Solr instances, **manually** modify your Kubernetes Monitoring Helm chart with these configuration snippets.

Replace any values between the angle brackets `<>` in the provided snippets with your desired configuration values.

#### Metrics snippets

Alloy ![Copy code to clipboard](https://grafana.com/media/images/icons/icon-copy-small-2.svg) Copy

```alloy
alloy-metrics:
    extraConfig: |-
        discovery.kubernetes "apache_solr" {
            role = "endpoints"
            selectors {
                role = "service"
                field = "metadata.name=<solr_service_name>"
            }
        }

        discovery.relabel "apache_solr" {
            targets = discovery.kubernetes.apache_solr.targets
        
            rule {
                source_labels = ["__meta_kubernetes_namespace", "__meta_kubernetes_pod_name"]
                separator = "-"
                target_label = "instance"
            }
            rule {
                replacement = "<your-cluster-name>"
                target_label = "solr_cluster"
            }
        }
        
        prometheus.scrape "solr_metrics" {        
        targets      = discovery.relabel.integrations_solr.output
        metrics_path = "/metrics"
        job_name     = "integrations/apache-solr"
        forward_to   = [prometheus.remote_write.grafana_cloud_metrics.receiver]
        }
```

#### Logs snippets

Alloy ![Copy code to clipboard](https://grafana.com/media/images/icons/icon-copy-small-2.svg) Copy

```alloy
podLogs:
    extraDiscoveryRules: |-
        rule {
            source_labels = ["__meta_kubernetes_namespace","__meta_kubernetes_pod_name"]
            separator     = ":"
            regex         = "<solr-namespace>:<solr-pod-name>"
            replacement   = "apache_solr"
            target_label  = "integration"
        }
        
        rule {
            source_labels = ["integration", "__meta_kubernetes_pod_ip","__meta_kubernetes_pod_container_port_number"]
            separator = ":"
            regex = "apache_solr:(.*):(.*)"
            replacement = "$1:$2"
            target_label  = "instance"
        }
    
        rule {
            source_labels = ["integration"]
            regex = "apache_solr"
            replacement = "/var/log/solr/solr.log"
            target_label = "filename"
        }

    extraLogProcessingStages: |-
        stage.match {
            selector = "{integration=\\"apache_solr\\"}"

            stage.multiline {
                firstline = "^\\\\d{4}-\\\\d{2}-\\\\d{2} \\\\d{2}:\\\\d{2}:\\\\d{2}\\\\.\\\\d{3}"
            }
            stage.regex {
                expression = "^\\\\d{4}-\\\\d{2}-\\\\d{2} \\\\d{2}:\\\\d{2}:\\\\d{2}\\\\.\\\\d{3} (?P<level>\\\\w+)"
            }
            stage.labels {
                values = {
                    level = "",
                }
            }
            stage.static_labels {
                values = {
                    solr_cluster = "<your-cluster-name>",
                    job = "integrations/apache-solr",
                }
            }
        }
```

## Dashboards

The Apache Solr integration installs the following dashboards in your Grafana Cloud instance to help monitor your system.

- Apache Solr cluster overview
- Apache Solr logs
- Apache Solr query performance
- Apache Solr resource monitoring

**Apache Solr overview (cluster)**

**Apache Solr overview (top metrics)**

**Apache Solr query performance (latency)**

## Alerts

The Apache Solr integration includes the following useful alerts:

Expand table

| Alert                                   | Description                                                                                                                   |
|-----------------------------------------|-------------------------------------------------------------------------------------------------------------------------------|
| ApacheSolrZookeeperChangeInEnsembleSize | Warning: Changes in the ZooKeeper ensemble size can affect the stability and performance of the cluster.                      |
| ApacheSolrHighCPUUsageCritical          | Critical: High CPU load can indicate that Solr nodes are under heavy load, potentially impacting performance.                 |
| ApacheSolrHighCPUUsageWarning           | Warning: High CPU load can indicate that Solr nodes are under heavy load, potentially impacting performance.                  |
| ApacheSolrHighHeapMemoryUsageCritical   | Critical: High heap memory usage can lead to garbage collection issues, out-of-memory errors, and overall system instability. |
| ApacheSolrHighHeapMemoryUsageWarning    | Warning: High heap memory usage can lead to garbage collection issues, out-of-memory errors, and overall system instability.  |
| ApacheSolrLowCacheHitRatio              | Warning: Low cache hit ratios can lead to increased disk I/O and slower query response times.                                 |
| ApacheSolrHighCoreErrors                | Warning: A spike in core errors can indicate serious issues at the core level, affecting data integrity and availability.     |
| ApacheSolrHighDocumentIndexing          | Warning: A sudden spike in document indexing could indicate unintended or malicious bulk updates.                             |

## Metrics

The most important metrics provided by the Apache Solr integration, which are used on the pre-built dashboards and Prometheus alerts, are as follows:

- solr\_collections\_live\_nodes
- solr\_collections\_replica\_state
- solr\_collections\_shard\_state
- solr\_metrics\_core\_errors\_total
- solr\_metrics\_core\_query\_5minRate
- solr\_metrics\_core\_query\_client\_errors\_1minRate
- solr\_metrics\_core\_query\_errors\_1minRate
- solr\_metrics\_core\_query\_local\_5minRate
- solr\_metrics\_core\_query\_local\_p95\_ms
- solr\_metrics\_core\_query\_local\_p99\_ms
- solr\_metrics\_core\_query\_p95\_ms
- solr\_metrics\_core\_query\_p99\_ms
- solr\_metrics\_core\_searcher\_cache
- solr\_metrics\_core\_searcher\_cache\_ratio
- solr\_metrics\_core\_timeouts\_total
- solr\_metrics\_core\_update\_handler\_adds\_total
- solr\_metrics\_jetty\_dispatches\_total
- solr\_metrics\_jetty\_requests\_total
- solr\_metrics\_jetty\_response\_total
- solr\_metrics\_jvm\_gc\_seconds\_total
- solr\_metrics\_jvm\_gc\_total
- solr\_metrics\_jvm\_memory\_heap\_bytes
- solr\_metrics\_jvm\_memory\_non\_heap\_bytes
- solr\_metrics\_jvm\_os\_cpu\_load
- solr\_metrics\_jvm\_os\_file\_descriptors
- solr\_metrics\_jvm\_os\_memory\_bytes
- solr\_metrics\_node\_connections
- solr\_metrics\_node\_core\_root\_fs\_bytes
- solr\_metrics\_node\_thread\_pool\_completed\_total
- solr\_metrics\_node\_thread\_pool\_submitted\_total
- solr\_metrics\_node\_timeouts\_total
- solr\_zookeeper\_ensemble\_size
- solr\_zookeeper\_status
- up

## Changelog

md ![Copy code to clipboard](https://grafana.com/media/images/icons/icon-copy-small-2.svg) Copy

```md
# 1.0.5 - October 2026

- Update the Solr reference guide links to version 8.11
- Update the metrics and logs instructions to match the configuration snippets

# 1.0.4 - November 2024

- Update mixin to fix various panel queries
- Update installation docs regarding `solr_cluster` label

# 1.0.3 - November 2024

- Update status panel check queries

# 1.0.2 - May 2024

- Added cluster selector to dashboards for kubernetes support
- Added default cluster label to agent config

# 1.0.1 - February 2024

- Fix alerts to trigger properly

# 1.0.0 - January 2024

- Initial release
```

## Cost

By connecting your Apache Solr instance to Grafana Cloud, you might incur charges. To view information on the number of active series that your Grafana Cloud account uses for metrics included in each Cloud tier, see [Active series and dpm usage](https://grafana.com/docs/grafana-cloud/fundamentals/active-series-and-dpm/) and [Cloud tier pricing](https://grafana.com/products/cloud/pricing/).
