---
title: "Apache CouchDB integration | Grafana Cloud documentation"
description: "Learn about Apache CouchDB 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 CouchDB integration for Grafana Cloud

Apache CouchDB is a NoSQL document-oriented database system known for its scalability, availability, and easy replication of data across multiple servers. This integration for Grafana Cloud allows users to collect metrics and system logs for monitoring an Apache CouchDB instance or clustered deployment. This integration also includes useful visualizations for both cluster and node metrics such as open databases, database writes/reads, request latency, request rates, response statuses, and replicator failure info.

This integration supports Apache CouchDB versions 3.2.x+.

This integration includes 10 useful alerts and 3 pre-built dashboards to help monitor and visualize Apache CouchDB metrics and logs.

## Before you begin

In order for the integration to properly work, one of two configurations changes must occur. Either a user must be given metric permissions or the unauthenticated Prometheus endpoint must be setup.

#### Granting metrics permissions to a user

If an admin user and password is not planned on being used in the metric configuration, a CouchDB user must instead be given the `_metrics` role when [creating a new user](https://docs.couchdb.org/en/stable/intro/security.html#creating-a-new-user).

Example

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

```none
curl http://localhost:5984/_users/org.couchdb.user:prom_user \
  -X PUT \
  -u admin:password \
  -H "Content-Type: application/json" \
  -d '{"name":"prom_user", "password":"prom_password", "roles": ["_metrics"], "type": "user"}'
```

#### Configuring the unauthenticated Prometheus endpoint

To enable the unauthenticated Prometheus endpoint for each node, CouchDB’s configuration file `local.ini` must be updated to include the correct [Prometheus configuration](https://docs.couchdb.org/en/stable/config/misc.html#prometheus).

Example

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

```none
[prometheus]
additional_port = true
bind_address = 127.0.0.1
port = 17986
```

## Install Apache CouchDB integration for Grafana Cloud

1. In your Grafana Cloud stack, click **Connections** in the left-hand menu.
2. Find **Apache CouchDB** 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 CouchDB 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 CouchDB 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 CouchDB instances, **manually** copy and append the snippets to your alloy configuration file, then follow subsequent instructions.

### Advanced metrics snippets

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

```alloy
discovery.relabel "metrics_integrations_integrations_apache_couchdb" {
	targets = concat(
		[{
			__address__ = "<your-node-hostname1>:5984",
		}],
		[{
			__address__ = "<your-node-hostname2>:5984",
		}],
		[{
			__address__ = "<your-node-hostname3>:5984",
		}],
	)

	rule {
		target_label = "couchdb_cluster"
		replacement  = "<your-cluster-name>"
	}

	rule {
		target_label = "instance"
		replacement  = constants.hostname
	}
}

prometheus.scrape "metrics_integrations_integrations_apache_couchdb" {
	targets      = discovery.relabel.metrics_integrations_integrations_apache_couchdb.output
	forward_to   = [prometheus.remote_write.metrics_service.receiver]
	job_name     = "integrations/apache-couchdb"
	metrics_path = "/_node/_local/_prometheus"

	basic_auth {
		username = "<couchdb_user>"
		password = "<couchdb_password>"
	}
}
```

To monitor your Apache CouchDB instance, you must use a [discovery.relabel](/docs/alloy/latest/reference/components/discovery.relabel/) component to discover your Apache CouchDB Prometheus endpoint and apply appropriate labels, followed by a [prometheus.scrape](/docs/alloy/latest/reference/components/prometheus.scrape) component to scrape it.

Configure the following properties within each `discovery.relabel` component:

- `__address__`: The address to your Apache CouchDB Prometheus metrics endpoint. The ports for the targets should be changed based on if you are using the authenticated endpoint (default `5984`) or the unauthenticated Prometheus endpoint (default `17986`).
- `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 CouchDB instance. Make sure this label value is the same for all telemetry data collected for this instance.
- `couchdb_cluster`: The `couchdb_cluster` label to group your Apache CouchDB instances within a cluster. Set the same value for all nodes within your cluster.

If you have multiple Apache CouchDB servers to scrape, configure one `discovery.relabel` for each and scrape them by including each under `targets` within the `prometheus.scrape` component.

Beware that the `prometheus.scrape` component must hold the auth information if your are running an autheticated Prometheus endpoint. Check the component documentation for the different auth options.

### Advanced logs snippets

#### darwin

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

```alloy
local.file_match "logs_integrations_integrations_apache_couchdb" {
	path_targets = [{
		__address__     = "localhost",
		__path__        = "/var/log/couchdb/couchdb.log",
		couchdb_cluster = "<your-cluster-name>",
		instance        = constants.hostname,
		job             = "integrations/apache-couchdb",
	}]
}

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

	stage.multiline {
		firstline     = "\\[[a-z]+\\] \\d+-\\d+-\\d+T\\d+:\\d+:\\d+\\.\\d+"
		max_lines     = 0
		max_wait_time = "3s"
	}
}

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

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

- [local.file\_match](/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 CouchDB instance address
  - `__path__`: The path to the log file.
  - `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 CouchDB instance. Make sure this label value is the same for all telemetry data collected for this instance.
  - `couchdb_cluster`: The `couchdb_cluster` label to group your Apache CouchDB instances within a cluster. Set the same value for all nodes within your cluster.
- [loki.process](/docs/alloy/latest/reference/components/loki.process) defines how to process logs before sending it to Loki.
- [loki.source.file](/docs/alloy/latest/reference/components/loki.source.file) sends logs to Loki.

On Linux, you will also need to add the `alloy` user to the `couchdb` group to get logs. Run the following command to configure the user as required:

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

```sh
sudo usermod -a -G couchdb alloy
```

#### linux

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

```alloy
local.file_match "logs_integrations_integrations_apache_couchdb" {
	path_targets = [{
		__address__     = "localhost",
		__path__        = "/var/log/couchdb/couchdb.log",
		couchdb_cluster = "<your-cluster-name>",
		instance        = constants.hostname,
		job             = "integrations/apache-couchdb",
	}]
}

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

	stage.multiline {
		firstline     = "\\[[a-z]+\\] \\d+-\\d+-\\d+T\\d+:\\d+:\\d+\\.\\d+"
		max_lines     = 0
		max_wait_time = "3s"
	}
}

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

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

- [local.file\_match](/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 CouchDB instance address
  - `__path__`: The path to the log file.
  - `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 CouchDB instance. Make sure this label value is the same for all telemetry data collected for this instance.
  - `couchdb_cluster`: The `couchdb_cluster` label to group your Apache CouchDB instances within a cluster. Set the same value for all nodes within your cluster.
- [loki.process](/docs/alloy/latest/reference/components/loki.process) defines how to process logs before sending it to Loki.
- [loki.source.file](/docs/alloy/latest/reference/components/loki.source.file) sends logs to Loki.

On Linux, you will also need to add the `alloy` user to the `couchdb` group to get logs. Run the following command to configure the user as required:

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

```sh
sudo usermod -a -G couchdb alloy
```

#### windows

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

```alloy
local.file_match "logs_integrations_integrations_apache_couchdb" {
	path_targets = [{
		__address__     = "localhost",
		__path__        = "/Program Files/Apache Software Foundation/CouchDB/var/log/couchdb.log",
		couchdb_cluster = "<your-cluster-name>",
		instance        = constants.hostname,
		job             = "integrations/apache-couchdb",
	}]
}

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

	stage.multiline {
		firstline     = "\\[[a-z]+\\] \\d+-\\d+-\\d+T\\d+:\\d+:\\d+\\.\\d+"
		max_lines     = 0
		max_wait_time = "3s"
	}
}

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

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

- [local.file\_match](/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 CouchDB instance address
  - `__path__`: The path to the log file.
  - `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 CouchDB instance. Make sure this label value is the same for all telemetry data collected for this instance.
  - `couchdb_cluster`: The `couchdb_cluster` label to group your Apache CouchDB instances within a cluster. Set the same value for all nodes within your cluster.
- [loki.process](/docs/alloy/latest/reference/components/loki.process) defines how to process logs before sending it to Loki.
- [loki.source.file](/docs/alloy/latest/reference/components/loki.source.file) sends logs to Loki.

## Kubernetes instructions

Instructions for Kubernetes

### Before you begin with Kubernetes

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

In order for the integration to properly work, one of two configurations changes must occur. Either a user must be given metric permissions or the unauthenticated Prometheus endpoint must be setup.

#### Granting metrics permissions to a user

If an admin user and password is not planned on being used in the metric configuration, a CouchDB user must instead be given the `_metrics` role when [creating a new user](https://docs.couchdb.org/en/stable/intro/security.html#creating-a-new-user).

Example

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

```none
curl http://localhost:5984/_users/org.couchdb.user:prom_user \
  -X PUT \
  -u admin:password \
  -H "Content-Type: application/json" \
  -d '{"name":"prom_user", "password":"prom_password", "roles": ["_metrics"], "type": "user"}'
```

#### Configuring the unauthenticated Prometheus endpoint

To enable the unauthenticated Prometheus endpoint for each node, CouchDB’s configuration file `local.ini` must be updated to include the correct [Prometheus configuration](https://docs.couchdb.org/en/stable/config/misc.html#prometheus).

Example

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

```none
[prometheus]
additional_port = true
bind_address = 127.0.0.1
port = 17986
```

### Configuration snippets for Kubernetes Helm chart

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

To scrape your Apache CouchDB 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](/media/images/icons/icon-copy-small-2.svg) Copy

```alloy
alloy-metrics:
    extraConfig: |-
        discovery.kubernetes "apache_couchdb" {
            role = "endpoints"
            selectors {
                role = "endpoints"
                label = "<apache_couchdb_pod_label>=<apache_couchdb_pod_label_value>"
            }
        }
        
        discovery.relabel "apache_couchdb" {
            targets = discovery.kubernetes.apache_couchdb.targets
        
            rule {
                source_labels = ["__meta_kubernetes_service_name","__meta_kubernetes_endpoint_port_name"]
                separator     = ":"
                regex         = ".*-couchdb:metrics"
                action        = "keep"
            }
        
            rule {
                replacement  = "<your-couchdb-cluster-name>"
                target_label = "couchdb_cluster"
            }
        }
        
        prometheus.scrape "apache_couchdb" {
            targets      = discovery.relabel.apache_couchdb.output
            metrics_path = "/_node/_local/_prometheus"
            forward_to   = [prometheus.remote_write.grafana_cloud_metrics.receiver]
            job_name     = "integrations/couchdb"
        }
```

#### Logs snippets

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

```alloy
podLogs:
    extraDiscoveryRules: |-
        rule {
            source_labels = ["__meta_kubernetes_namespace","__meta_kubernetes_pod_name","__meta_kubernetes_pod_container_port_name"]
            separator     = ":"
            regex         = "sample-apps:.*-couchdb.*:metrics"
            replacement   = "couchdb"
            target_label  = "integration"
        }
        
        rule {
            source_labels = ["integration","__meta_kubernetes_pod_ip","__meta_kubernetes_pod_container_port_number"]
            separator   = ":"
            regex        = "couchdb:(.*):(.*)"
            replacement  = "$1:$2"
            target_label = "instance"
        }

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

            stage.static_labels {
                values = {
                    couchdb_cluster = "<your-couchdb-cluster-name>",
                    job             = "integrations/apache-cassandra",
                    log_type        = "couchdb",
                }
            }

            stage.labels {
                values = {
                    instance = null,
                }
            }
        }
```

## Dashboards

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

- Apache CouchDB logs
- Apache CouchDB nodes
- Apache CouchDB overview

**Apache CouchDB overview (1/4)**

**Apache CouchDB overview (2/4)**

**Apache CouchDB overview (3/4)**

## Alerts

The Apache CouchDB integration includes the following useful alerts:

Expand table

| Alert                               | Description                                                                                  |
|-------------------------------------|----------------------------------------------------------------------------------------------|
| CouchDBUnhealthyCluster             | Critical: At least one of the nodes in a cluster is reporting the cluster as being unstable. |
| CouchDBHigh4xxResponseCodes         | Warning: There are a high number of 4xx responses for incoming requests to a node.           |
| CouchDBHigh5xxResponseCodes         | Critical: There are a high number of 5xx responses for incoming requests to a node.          |
| CouchDBModerateRequestLatency       | Warning: There is a moderate level of request latency for a node.                            |
| CouchDBHighRequestLatency           | Critical: There is a high level of request latency for a node.                               |
| CouchDBManyReplicatorJobsPending    | Warning: There is a high number of replicator jobs pending for a node.                       |
| CouchDBReplicatorJobsCrashing       | Critical: There are replicator jobs crashing for a node.                                     |
| CouchDBReplicatorChangesQueuesDying | Warning: There are replicator changes queue process deaths for a node.                       |
| CouchDBReplicatorOwnersCrashing     | Warning: There are replicator connection owner process crashes for a node.                   |
| CouchDBReplicatorWorkersCrashing    | Warning: There are replicator connection worker process crashes for a node.                  |

## Metrics

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

- couchdb\_couch\_log\_requests\_total
- couchdb\_couch\_replicator\_changes\_manager\_deaths\_total
- couchdb\_couch\_replicator\_changes\_queue\_deaths\_total
- couchdb\_couch\_replicator\_changes\_reader\_deaths\_total
- couchdb\_couch\_replicator\_cluster\_is\_stable
- couchdb\_couch\_replicator\_connection\_owner\_crashes\_total
- couchdb\_couch\_replicator\_connection\_worker\_crashes\_total
- couchdb\_couch\_replicator\_jobs\_crashes\_total
- couchdb\_couch\_replicator\_jobs\_pending
- couchdb\_database\_reads\_total
- couchdb\_database\_writes\_total
- couchdb\_erlang\_memory\_bytes
- couchdb\_httpd\_bulk\_requests
- couchdb\_httpd\_bulk\_requests\_total
- couchdb\_httpd\_request\_methods
- couchdb\_httpd\_status\_codes
- couchdb\_httpd\_temporary\_view\_reads\_total
- couchdb\_httpd\_view\_reads\_total
- couchdb\_httpd\_view\_timeouts\_total
- couchdb\_open\_databases
- couchdb\_open\_databases\_total
- couchdb\_open\_os\_files
- couchdb\_open\_os\_files\_total
- couchdb\_request\_time\_seconds
- couchdb\_request\_time\_seconds\_count
- couchdb\_request\_time\_seconds\_sum
- up

## Changelog

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

```md
# 1.1.0 - April 2026

* Updated dashboards to follow new stylistic standards
* Renamed alert `CouchDBReplicatorConnectionOwnersCrashing` to `CouchDBReplicatorOwnersCrashing`
* Renamed alert `CouchDBReplicatorConnectionWorkersCrashing` to `CouchDBReplicatorWorkersCrashing`
* Added logs dashboard `Apache CouchDB logs`

# 1.0.0 - May 2024

* Added cluster selector to dashboards for kubernetes support
* Added default cluster label to agent config
* Bump version to 1.0.0

# 0.0.3 - September 2023

* New Filter Metrics option for configuring the Grafana Agent, which saves on metrics cost by dropping any metric not used by this integration. Beware that anything custom built using metrics that are not on the snippet will stop working.
* New hostname relabel option, which applies the instance name you write on the text box to the Grafana Agent configuration snippets, making it easier and less error prone to configure this mandatory label.

# 0.0.2 - August 2023

* Add regex filter for logs datasource

# 0.0.1 - April 2023

* Initial release
```

## Cost

By connecting your Apache CouchDB 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](/docs/grafana-cloud/fundamentals/active-series-and-dpm/) and [Cloud tier pricing](/products/cloud/pricing/).
