---
updatedAt: 2025-08-12T15:29:01.000Z
agentTools:
  projectIndex: https://docs.scalr.io/llms.txt
---

# Datadog

Datadog is an analytics tool that can be used for event monitoring, log collection, and much more. As you scale your Terraform and OpenTofu usage, the ability to analyze the audit logs, run results, run execution time, and any other aspect of Terraform operations becomes extremely important to optimize your overall Terraform workflow.

## Events

The Datadog integration can currently stream event details for Terraform and OpenTofu runs executed in Scalr. To integrate with Datadog, simply go to the integrations page at the account scope, select Datadog, and add the necessary information:

![](https://files.readme.io/0f4b105-datadog.png "datadog.png")

At this point, just select the necessary connections, and the integration is complete. You will now see run events in Datadog, including the status, VCS information, provider configurations used, and more:

![](https://files.readme.io/0ee3926-datadog_events.png "datadog_events.png")

You can now build reports and dashboards in Datadog to analyze your Terraform events. For example, break down run results per environment:

![](https://files.readme.io/ed8da01-datadog_run_results.png "datadog_run_results.png")

## Metrics

Send metrics to Datadog for in-depth analysis and reporting such as queue runs, queue state, the number of environments, and workspace count. These metrics are visualized in their out-of-the-box dashboard to help correlate deployments with other infrastructure changes and to track trends within your pipeline.

See how to install the Datadog agent and enable the Scalr integration [here](https://docs.datadoghq.com/integrations/scalr/). The permission needed for the token in the agent is `accounts:read`. Only current metrics will be sent to Datadog, no historical information.

| Metric                                 | Descriptions                                                                         |
| :------------------------------------- | :----------------------------------------------------------------------------------- |
| scalr.environments.count               | Total number of environments                                                         |
| scalr.workspaces.count                 | Total number of workspaces                                                           |
| scalr.runs.count                       | Total number of runs                                                                 |
| scalr.runs.successful                  | Number of runs in applied or planned\_and\_finished status                           |
| scalr.runs.failed                      | Number of runs in an errored status                                                  |
| scalr.runs.awaiting\_confirmation      | Number of runs in planned, policy\_checked, policy\_override, cost\_estimated status |
| scalr.runs.concurrency                 | Number of runs in planning, policy\_checking, cost\_estimating, applying status      |
| scalr.runs.queue\_size                 | Number of runs in plan\_queued or apply\_queued status                               |
| scalr.quota.max\_concurrency           | The quota.max\_concurrent\_runs value (account quota)                                |
| scalr.billing.runs.count               | The number of runs in the current billing period                                     |
| scalr.billing.run\_minutes.count       | The number of run minutes used in the current billing period                         |
| scalr.billing.flex\_runs.count         | The number of flex runs used in the current billing period                           |
| scalr.billing.flex\_run\_minutes.count | The number of run minutes used in current billing period                             |

You can also utilize the Scalr integrations dashboard by default by going to Dashboards->Integrations in Datadog:

<Image align="center" width="smart" src="https://files.readme.io/e26b3d0-Screen_Shot_2022-12-13_at_10.11.36_AM.png" />

## Audit Logs

Audit logs allow you to get insights into all actions taken, who performed the action, how it was done, and more. The audit log feature can use the same Datadog connection that is used for events or a new one can be created.

To enable audit logs, go to the **account settings** page and click on **audit logs**. Enable the streaming of logs, select Datadog as the destination, and add the connection:

<Image align="center" src="https://files.readme.io/e99d0bf-Screenshot_2024-02-16_at_8.00.19_AM.png" />

You will now see the Scalr logs in the Datadog logs feature:

<Image align="center" src="https://files.readme.io/e3e6b2a-Screenshot_2024-02-16_at_8.56.05_AM.png" />

Here is an example of a full log output:

```
{
	"id": "AgAAAY2x_1pxzx914QAAAAAAAAAYAAAAAEFZMnhfMXRKQUFDY1RCNUtZb3FoTlFBQQAAACQ12345656E4ZGIxZmYtNWE3MS00MTU3LWJlMTctODhmMTZhYTU5Nzhl",
	"content": {
		"timestamp": "2024-02-16T12:58:38.577Z",
		"tags": [
			"scalr-workspace-name:demo-ws",
			"scalr-environment-name:cs-m",
			"scalr-workspace:ws-v0o370ouv5kbjmk9h",
			"scalr-user-email:docs@scalr.com",
			"scalr-action:discard-run",
			"scalr-environment:org-sscctbkdgkdr123",
			"source:scalr",
			"datadog.submission_auth:private_api_key"
		],
		"host": "docs.scalr.io",
		"service": "audit-log",
		"attributes": {
			"actor": {
				"id": "user-stp8qjepev3a123",
				"access-token": {
					"type": "session",
					"token": "...B6wifA"
				},
				"type": "user",
				"email": "docs@scalr.com"
			},
			"request": {
				"ip-address": "69.206.111.123",
				"action": "discard-run",
				"id": "a3a473d725c730382558c25d52bd1234",
				"source": "ui",
				"user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36"
			},
			"hostname": "docs.scalr.io",
			"service": "audit-log",
			"outcome": {
				"result": "SUCCESS",
				"status-code": 202
			},
			"target": {
				"display-name": "run-v0o370pcff0e53123",
				"context": {
					"environment": {
						"display-name": "CS-M",
						"id": "org-sscctbkdgkdrqg0"
					},
					"workspace": {
						"display-name": "demo-ws",
						"id": "ws-v0o370ouv5kbjmk9h"
					},
					"account": {
						"display-name": "docs",
						"id": "acc-sscctbisjkl3123"
					}
				},
				"id": "run-v0o370pcff0e53",
				"type": "runs"
			},
			"timestamp": "2024-02-16T12:58:38.577846"
		}
	}
}
```

### Audit Log Disabled Alerts

To maintain compliance and visibility, Scalr sends an `AuditLogDisabled` event when audit log streaming is disabled or switched to a different destination. This ensures admins are immediately notified of changes that may introduce security or compliance risks.

Sample Message:

```Text json
{
    "title": "Audit Log Disabled.",
    "timestamp": "2025-04-29T13:31:50.345890+00:00",
    "user-id": 17378,
    "user-email": "user@scalr.com",
    "disabled-integration": {
        "id": "in-v0ohugh97e91o0dk3",
        "name": "Datadog_DPN",
        "type": "Datadog"
    }
}
```

## Demo

<Embed url="https://www.youtube.com/watch?v=O3OagxxmEuE" title="New Feature: Datadog Integration" favicon="http://www.google.com/favicon.ico" image="https://i.ytimg.com/vi/O3OagxxmEuE/hqdefault.jpg" provider="youtube.com" href="https://www.youtube.com/watch?v=O3OagxxmEuE" typeOfEmbed="youtube" html="%3Ciframe%20class%3D%22embedly-embed%22%20src%3D%22%2F%2Fcdn.embedly.com%2Fwidgets%2Fmedia.html%3Fsrc%3Dhttps%253A%252F%252Fwww.youtube.com%252Fembed%252FO3OagxxmEuE%253Ffeature%253Doembed%26display_name%3DYouTube%26url%3Dhttps%253A%252F%252Fwww.youtube.com%252Fwatch%253Fv%253DO3OagxxmEuE%26image%3Dhttps%253A%252F%252Fi.ytimg.com%252Fvi%252FO3OagxxmEuE%252Fhqdefault.jpg%26key%3D7788cb384c9f4d5dbbdbeffd9fe4b92f%26type%3Dtext%252Fhtml%26schema%3Dyoutube%22%20width%3D%22854%22%20height%3D%22480%22%20scrolling%3D%22no%22%20title%3D%22YouTube%20embed%22%20frameborder%3D%220%22%20allow%3D%22autoplay%3B%20fullscreen%22%20allowfullscreen%3D%22true%22%3E%3C%2Fiframe%3E" />

# Sibling pages

* [AWS EventBridge](https://docs.scalr.io/scalr/docs/aws-event-bridge.md)
* [Azure DevOps](https://docs.scalr.io/scalr/docs/azure-devops.md)
* [Backstage](https://docs.scalr.io/scalr/docs/backstage.md)
* [Bitbucket Cloud](https://docs.scalr.io/scalr/docs/bitbucket-cloud.md)
* [Bitbucket Datacenter](https://docs.scalr.io/scalr/docs/bitbucket-datacenter.md)
* [Checkov](https://docs.scalr.io/scalr/docs/checkov.md)
* [Dependabot](https://docs.scalr.io/scalr/docs/dependabot.md)
* [GitHub](https://docs.scalr.io/scalr/docs/github.md)
* [GitLab](https://docs.scalr.io/scalr/docs/gitlab.md)
* [Infracost](https://docs.scalr.io/scalr/docs/infracost.md)
* [Microsoft Teams](https://docs.scalr.io/scalr/docs/msteams.md)
* [OpenMetrics](https://docs.scalr.io/scalr/docs/openmetrics.md)
* [OpenTofu](https://docs.scalr.io/scalr/docs/opentofu.md)
* [Open Policy Agent](https://docs.scalr.io/scalr/docs/policy-as-code.md)
* [Renovate](https://docs.scalr.io/scalr/docs/renovate.md)
* [Single Sign-On (SSO)](https://docs.scalr.io/scalr/docs/single-sign-on.md)
* [Slack](https://docs.scalr.io/scalr/docs/slack.md)
* [Terraform](https://docs.scalr.io/scalr/docs/terraform.md)
* [Terragrunt](https://docs.scalr.io/scalr/docs/terragrunt.md)
* [VSCode Extension](https://docs.scalr.io/scalr/docs/vscode-extension.md)
* [Webhooks](https://docs.scalr.io/scalr/docs/webhooks.md)
* [Wiz](https://docs.scalr.io/scalr/docs/wiz.md)