pydo.databases.create_logsink()

Generated on 8 May 2026 from pydo version v0.34.0

Usage

client.databases.create_logsink(
    database_cluster_uuid="9cc10173-e9ea-4176-9dbc-a4cee4c4ff30",
    body={
        "sink_name": "prod-logsink",
        "sink_type": "rsyslog",
        "config": {...},
    },
)
Returns JSONRaises HttpResponseError

Description

To create logsink for a database cluster, send a POST request to /v2/databases/{database_cluster_uuid}/logsink.

Parameters

database_cluster_uuid string required

A unique identifier for a database cluster.

sink_name string required

Example: prod-logsink

The name of the Logsink

sink_type string required

Type of logsink integration.

- Use datadog for Datadog integration only with MongoDB clusters.
- For non-MongoDB clusters, use rsyslog for general syslog forwarding.
- Other supported types include elasticsearch and opensearch.

More details about the configuration can be found in the config property.

One of: rsyslog, elasticsearch, opensearch, datadog

config object required
Show child properties
server string optional

Example: 192.168.0.1

DNS name or IPv4 address of the rsyslog server

port integer optional

Example: 514

The internal port on which the rsyslog server is listening

Max: 65535

tls boolean optional

Example: False

Use TLS (as the messages are not filtered and may contain sensitive information, it is highly recommended to set this to true if the remote server supports it)

format string optional

Message format used by the server, this can be either rfc3164 (the old BSD style message format), rfc5424 (current syslog message format) or custom

One of: rfc5424, rfc3164, custom

logline string optional

Example: <%pri%>%timestamp:::date-rfc3339% %HOSTNAME% %app-name% %msg%

Conditional (required if format == custom).

Syslog log line template for a custom format, supporting limited rsyslog style templating (using %tag%). Supported tags are: HOSTNAME, app-name, msg, msgid, pri, procid, structured-data, timestamp and timestamp:::date-rfc3339.

---
Datadog Integration Example for Non-Mongo clusters:
``
DD_KEY <%pri%>1 %timestamp:::date-rfc3339% %HOSTNAME%.DB_NAME %app-name% - - - %msg%
`
- Replace
DD_KEY with your actual Datadog API key.
- Replace
DB_NAME with the actual name of your database cluster.
- Configure the Server:
- US Region: Use
intake.logs.datadoghq.com
- EU Region: Use
tcp-intake.logs.datadoghq.eu
- Configure the Port:
- US Region: Use port
10516
- EU Region: Use port
443
- Enable TLS:
- Ensure the TLS checkbox is enabled.
- Note: This configuration applies to **non-Mongo clusters only**. For **Mongo clusters**, use the
datadog_logsink` integration instead.

sd string optional

Example: TOKEN tag="LiteralValue"

content of the structured data block of rfc5424 message

ca string optional

Example: -----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----\n

PEM encoded CA certificate

key string optional

Example: -----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n

(PEM format) client key if the server requires client authentication

cert string optional

Example: -----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----\n

(PEM format) client cert to use

url string optional

Example: https://user:[email protected]:9200

Opensearch connection URL

index_prefix string optional

Example: opensearch-logs

Opensearch index prefix

index_days_max integer optional

Example: 5

Maximum number of days of logs to keep

Min: 1

Max: 10000

Default: 7

timeout number optional

Example: 10

Opensearch request timeout limit

Min: 10

Max: 120

Default: 10

site string optional

Example: http-intake.logs.datadoghq.com

Datadog connection URL

datadog_api_key string optional

Example: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Datadog API key

Request Sample

Show Request Sample
import os
from pydo import Client

client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))

req = {
  "sink_name": "logs-sink",
  "sink_type": "opensearch",
  "config": {
    "url": "https://user:[email protected]:25060",
    "index_prefix": "opensearch-logs",
    "index_days_max": 5
  }
}

resp = client.databases.create_logsink(database_cluster_uuid="9cc10173-e9ea-4176-9dbc-a4cee4c4ff30", body=req)

Response Example

Show Response Example
{
  "sink": {
    "sink_id": "dfcc9f57d86bf58e321c2c6c31c7a971be244ac7",
    "sink_name": "logs-sink",
    "sink_type": "opensearch",
    "config": {
      "url": "https://user:[email protected]:25060",
      "index_prefix": "opensearch-logs",
      "index_days_max": 5
    }
  }
}

More Information

See /v2/databases/{database_cluster_uuid}/logsink in the API reference for additional detail on responses, headers, parameters, and more.

We can't find any results for your search.

Try using different keywords or simplifying your search terms.