---
title: "DigitalOcean Managed Databases"
description: "Set up Middleware integration with DigitalOcean Managed DB to monitor database health, performance, and errors."
section: "Database"
breadcrumb: "Database > DigitalOcean Managed Databases"
canonical: "https://docs.middleware.io/integrations/digitalocean-managed-databases"
---
# DigitalOcean Managed Databases

[DigitalOcean Managed Databases](https://www.digitalocean.com/products/managed-databases) provide a fully managed, high-performance database cluster service.

Middleware enables seamless metrics and log collection from the following databases hosted on the DigitalOcean managed platform:

- **[PostgreSQL](https://www.digitalocean.com/products/managed-databases-postgresql)**
- **[MySQL](https://www.digitalocean.com/products/managed-databases-mysql)**
- **[Redis (Caching)](https://www.digitalocean.com/products/managed-databases-redis)**
- **[Kafka](https://www.digitalocean.com/products/managed-databases-kafka)**

## Prerequisites

Before setting up the integration, ensure you have a **Droplet with Docker** installed in the same VPC as your DigitalOcean managed database cluster.

## Step-by-Step Configuration

### 1 Create Prometheus Configuration

Run the following command on your Droplet, replacing ***<database-name>*** with the database name you wish to observe:

```bash
DATABASE_NAME=<database-name> bash -c "$(curl -L https://install.middleware.io/scripts/digitalocean/do-managed-db-prometheus.sh)"
```

This script will:

- Ask for your DigitalOcean API token.
- Generate a `prometheus.yml` file, which will be used by `do-collector` (installed in Step 2).

#### **Customization Options**

You can use following environment variable to customize the script:

- **MW_PROMETHEUS_DIR** – Directory where the `prometheus.yml` file and required certificates are stored on the Droplet. (Default: `/etc/prometheus`)

### 2 Install Middleware’s do-collector

The `do-collector` reads the **Prometheus configuration** from Step 1 and forwards metrics to Middleware.

Run the following command to install `do-collector` on the Droplet:

```bash
MW_API_KEY=your-initial-token MW_TARGET=your-initial-uid bash -c "$(curl -L https://install.middleware.io/scripts/digitalocean/do-collector-docker-install.sh)"
```

#### Customization Options

This script supports the following environment variables:

- **MW_PROMETHEUS_DIR** – Directory for `prometheus.yml` and certificates. If you had set this environment variable in the script used in step 1, you should use the same value here. (Default: `/etc/prometheus`)
- **MW_LOG_LEVEL** – Logging level for `do-collector`. (Default: `info`)
- **MW_SYSLOG_HOST** – `Endpoint` used in database log forwarding settings. (Default: Public IP address of the Droplet)
- **MW_SYSLOG_PORT** – `Port` used in database log forwarding settings. (Default: `5514`)

> **Warning:** If you set `MW_PROMETHEUS_DIR` in Step 1, you must use the same value in this step.

> **Note:** **Metric collection for your database will start automatically after this step.**

### 3 Configure Logging

Once `do-collector` is installed, the script will output the details for log forwarding. Use this information to configure **Rsyslog** destination in your DigitalOcean managed database.

To configure log forwarding:

**3.a** Go to the **Settings** section of your DigitalOcean Managed Database.

![DO Managed DB Settings](/images/digital-ocean/managed-db-settings.png)

**3.b** Under Log Forwarding, select the Rsyslog option.

![DO Managed DB Log Forwarding](/images/digital-ocean/managed-db-log-forwarding.png)

Enter the following details:

- **Destination Name**: `<database-name>-middleware.io`
- **Endpoint**: Public IP address of the Droplet running the `do-collector` container.
- **Port**: `5514`
- **Enable TLS Support**: ✖ Uncheck this option.
- **Message Format**: `Custom`
- **Log Line Template**:` <%pri%>1 %timereported:::date-rfc3339% %HOSTNAME% %app-name% %procid% - - %msg%\n`

![DO Managed DB Rsyslog](/images/digital-ocean/managed-db-rsyslog.png)

> **Note:** All the configuration details for log forwarding is also output by the script in Step 2.

> **Note:** <database-name> in the **Destination Name** is the name of your Database for which log forwarding is being configured.

> **Note:** `5514` is the default **RSyslog** port used by `do-collector`. This can be customized by setting `MW_SYSLOG_PORT` environment variable used by the script in step 2.

> **Warning:** Ensure that **Log Line Template** value is exactly as shown above including the `\n` at the end.

### 4 Hardening Access

To enhance security:

- Add the Droplet running `do-collector` to the **Trusted Sources** configuration of your database clusters.
- Configure firewall rules on the Droplet to allow incoming connections from your database clusters to the Syslog port used by `do-collector` (**5514** by default). This ensures that only authorized sources can send logs to the `do-collector`.
