DigitalOcean Managed Databases

DigitalOcean 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:

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:

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:

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_HOSTEndpoint used in database log forwarding settings. (Default: Public IP address of the Droplet)
  • MW_SYSLOG_PORTPort used in database log forwarding settings. (Default: 5514)

If you set MW_PROMETHEUS_DIR in Step 1, you must use the same value in this step.

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

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

DO Managed DB Log Forwarding

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

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

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

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.

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.