> ## Documentation Index
> Fetch the complete documentation index at: https://docs.controlplane.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Datadog

> Configure log shipping from Control Plane to Datadog for comprehensive log management, analytics, and visualization.

## Overview

[Datadog](https://www.datadoghq.com) is a robust and comprehensive monitoring service for cloud-scale applications, providing full visibility into IT infrastructure. The service combines metrics and events from servers, databases, applications, tools, and services to present a unified view of an entire stack.

[Datadog](https://www.datadoghq.com) is capable of ingesting, analyzing, and visualizing logs from a variety of sources, including servers. This feature is a part of [Datadog](https://www.datadoghq.com/)'s Log Management solution, which provides essential capabilities such as real-time log tailing and filtering, log analytics, and detailed visualizations. It can handle a wide range of log formats, including but not limited to, JSON, syslog, and common application logs.

[Datadog](https://www.datadoghq.com) offers capabilities for log retention and archiving, enabling compliance with various regulatory standards. It also supports role-based access controls to secure your logs and control who can access what information.

Follow the steps below to configure log shipping to [Datadog](https://www.datadoghq.com).

## Step 1 - Credential Procurement

An API key is required to ship logs to [Datadog](https://www.datadoghq.com).

Follow these steps to obtain the API key, store it as an [Opaque Secret](/reference/secret#opaque), and configure external logging.

1. From the [Datadog](https://www.datadoghq.com) dashboard, hover over your username at the bottom of the left menu and click `Organization Settings`.
2. In the middle menu, click `API Keys`.
3. Click the `New Key` button in the upper right corner, enter a key name, and click `Create Key`.
4. Click the `Copy Key` button. This will copy the key to your clipboard. Click the `X` to close the modal.
5. From the Control Plane Console UI, click `Secrets` from the left menu.
6. Click the `New` button.
7. Enter a `Name` for the secret, and select `Opaque` from the `Secret Type` list.
8. Paste the string from step #4 into the content text box and click `Create`.
9. This secret will be used when configuring logging using the [UI Console](#enable-logging-using-the-ui-console) or [CLI](#enable-logging-using-the-cli).

## Step 2 - Configure External Logging

External logging can be configured by using either the [UI Console](#enable-logging-using-the-ui-console) or [CLI](#enable-logging-using-the-cli).

### Enable Logging using the UI Console

1. From the Control Plane Console UI, click on `Org` in the left menu.
2. Click `External Logs` in the middle context menu.
3. Select `Datadog` and fill out the required fields.
4. Select the Opaque secret created to authenticate to [Datadog](https://www.datadoghq.com). Refer to the [credential procurement](#step-1-credential-procurement) section to obtain and configure the necessary credentials.
5. Click `Save`.
6. After the configuration is complete, log entries will be available at [Datadog](https://www.datadoghq.com) within a few minutes.

<Tip>
  The hostname will be similar to the domain name that resolves when using the [Datadog](https://www.datadoghq.com) dashboard. (i.e., The host `http-intake.logs.us3.datadoghq.com` maps to the dashboard domain `us3.datadoghq.com`)
</Tip>

### Enable Logging using the CLI

The external logging configuration can be created / updated using the CLI's `cpln org patch ORG_NAME -f FILE.yaml` command.

Below is an example of an [Org](/reference/org) manifest (in YAML). Edit and save the YAML as a file and use it as an input to the CLI's `cpln org patch ORG_NAME -f FILE.yaml` command.

Refer to the [credential procurement](#step-1-credential-procurement) section to obtain and configure the necessary credentials.

* Substitute: `ORG_NAME`, `OPAQUE_SECRET`, and possibly the host.

<Note>
  Use the host URL that matches your [Datadog](https://www.datadoghq.com) account. The host will be a similar domain name that resolves when using the [Datadog](https://www.datadoghq.com) dashboard.
</Note>

```yaml YAML theme={null}
kind: org
name: ORG_NAME
spec:
  logging:
    datadog:
      host: http-intake.logs.us3.datadoghq.com
      credentials: //secret/OPAQUE_SECRET
```
