> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/harness-platform/use-harness-platform/connectors/monitoring-and-logging-systems/add-a-datadog-connector.md).

# Add a Datadog connector

Add a Datadog connector so Harness can fetch metrics and logs from Datadog for verification.

Datadog is a cloud-based monitoring and analytics platform that collects metrics, logs, and traces from applications and infrastructure. Add a Datadog connector in Harness to let your pipelines query your Datadog data. Harness can then use that data in Continuous Verification to compare application behavior before and after a deployment, helping you confirm a release is healthy or trigger a rollback.

Go to [Overview](https://developer.harness.io/harness-platform/use-harness-platform/connectors/monitoring-and-logging-systems/monitoring-and-logging-systems-connectors-overview.md) for information about all monitoring and logging connectors, such as scopes and delegate selection.

***

## What you will learn from this topic

* How to [add a Datadog connector](#add-a-datadog-connector) to a Harness project.
* How to configure the [URL and keys](#credentials) that Harness uses to authenticate with Datadog.

***

## Before you begin

* **Datadog access**: A Datadog account with permission to create API keys and application keys.
* **Harness permissions**: Permission to create connectors and secrets in Harness.

***

## Add a Datadog connector

You can add a Datadog connector at the project, org, or account scope. This procedure covers the project scope, and the process is the same for org and account.

Perform the following steps to add a Datadog connector:

1. Open your Harness project.
2. In **Project Settings**, select **Connectors**.
3. Click **New Connector**, then select **Datadog** under **Monitoring and Logging Systems**. The Datadog connector settings appear.

### Overview

Configure the identity fields for the connector:

1. In **Name**, enter a name for the connector. Harness generates the **Id** from the name.
2. Optionally, add a **Description** and **Tags**.
3. Click **Continue**.

![Datadog connector overview settings](https://173309742-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3F2TpHXhur2QtQnORSM9%2Fuploads%2Fgit-blob-bd4075f11519932a278a82e41a93c3f1e554031c%2Fconnect-to-monitoring-and-logging-systems-24.png?alt=media)

### Credentials

Configure the following settings:

1. In **URL**, enter the Datadog API URL. To build it, copy the protocol and domain of your Datadog URL, such as `https://app.datadoghq.com/`, then append `api/`. The trailing forward slash is mandatory. If your URL ends in `v1`, remove `v1`. The URL must match one of the following:
   * `https://app.datadoghq.com/api/`
   * `https://us3.datadoghq.com/api/`
   * `https://us5.datadoghq.com/api/`
   * `https://app.datadoghq.eu/api/`
   * `https://app.ddog-gov.com/api/`
2. In **Encrypted Application Key**, select or create a [Harness encrypted text secret](https://developer.harness.io/harness-platform/use-harness-platform/secrets/add-use-text-secrets.md) that stores the Datadog application key. Go to [API and Application Keys](https://docs.datadoghq.com/account_management/api-app-keys/) in Datadog documentation to create an application key in Datadog.
3. In **Encrypted API Key**, select or create a [Harness encrypted text secret](https://developer.harness.io/harness-platform/use-harness-platform/secrets/add-use-text-secrets.md) that stores the Datadog API key. Go to [API and Application Keys](https://docs.datadoghq.com/account_management/api-app-keys/) in Datadog documentation to create an API key in Datadog.
4. Click **Next**.

![Datadog connector credentials with the URL, application key, and API key fields](https://173309742-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3F2TpHXhur2QtQnORSM9%2Fuploads%2Fgit-blob-630f8d030863ee26f0549b2c07685db7e76c8b86%2Fdatadog-connector-credentials.png?alt=media)

**Application key scopes for Continuous Verification**

When you create the Datadog application key, ensure it has at least the following scopes:

* `timeseries_query`: Fetch metrics data.
* `logs_read_data`: Read log data.
* `metrics_read`: Read metrics metadata.
* `events_read`: Read events.
* `monitors_read`: Read monitor configurations.
* `dashboards_read`: Read dashboard configurations.

Go to the Datadog [Metrics API](https://docs.datadoghq.com/api/latest/metrics/) and [Logs API](https://docs.datadoghq.com/api/latest/logs/) documentation for details on Datadog API scopes.

### Delegates Setup

Select one of the following options:

* **Use any available Delegate**: Harness selects an available delegate at runtime.
* **Only use Delegates with all of the following tags**: Enter the tags of the delegates Harness must use with this connector.

The **Test Delegate Connectivity** list shows the delegates that match your selection. To add a delegate, click **Install new Delegate**.

Click **Save and Continue**.

![Datadog connector delegates setup with the delegate connectivity list](https://173309742-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3F2TpHXhur2QtQnORSM9%2Fuploads%2Fgit-blob-14571d082bbf46b8c4dfe352806656384d959e5a%2Fdatadog-connector-delegates-setup.png?alt=media)

### Verify Connection

Click **Finish** after the connection test succeeds. The connector is listed in **Connectors** page.

***

## Sample YAML

The following example shows a YAML for the Datadog connector created in this topic.

<details>

<summary>YAML - Datadog connector</summary>

```yaml
connector:
  name: your-datadog-connector # Replace with a name for your connector
  identifier: yourdatadogconnector # Replace with a unique identifier
  description: ""
  accountIdentifier: youraccountidentifier # Replace with your Harness account identifier
  orgIdentifier: default # Replace with your organization identifier, or remove for account scope
  projectIdentifier: yourprojectidentifier # Replace with your project identifier, or remove for org/account scope
  type: Datadog
  spec:
    url: https://app.datadoghq.com/api/ # Replace with the Datadog API URL for your site
    applicationKeyRef: your-application-key-secret # Replace with a reference to the Harness secret storing your application key
    apiKeyRef: your-api-key-secret # Replace with a reference to the Harness secret storing your API key
    ignoreTestConnection: false # Set to true only to skip connector preflight checks
```

</details>

For the full connector YAML schema, including how to skip connector preflight checks, go to [Create a connector using YAML](https://developer.harness.io/harness-platform/use-harness-platform/connectors/create-a-connector-using-yaml.md).

***

## Next steps

* [Use delegate selectors](https://developer.harness.io/harness-platform/use-harness-platform/delegates/delegate/manage-delegates/select-delegates-with-selectors.md): Control which delegates can connect to this connector.
* [Add a text secret](https://developer.harness.io/harness-platform/use-harness-platform/secrets/add-use-text-secrets.md): Store the Datadog keys as Harness secrets.
