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.


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:

At this point, just select the necessary connections and the integration is complete. You will now see run events in Datadog!

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


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. The permission needed for the token in the agent is accounts:read. Only current metrics will be sent to Datadog, no historical information.

scalr.environments.countTotal number of environments
scalr.workspaces.countTotal number of workspaces
scalr.runs.countTotal number of runs
scalr.runs.successfulNumber of runs in applied or planned_and_finished status
scalr.runs.failedNumber of runs in an errored status
scalr.runs.awaiting_confirmationNumber of runs in planned, policy_checked, policy_override, cost_estimated status
scalr.runs.concurrencyNumber of runs in planning, policy_checking, cost_estimating, applying status
scalr.runs.queue_sizeNumber of runs in plan_queued or apply_queued status
scalr.quota.max_concurrencyThe quota.max_concurrent_runs value (account quota)
scalr.billing.runs.countThe number of runs in the current billing period
scalr.billing.run_minutes.countThe number of run minutes used in the current billing period
scalr.billing.flex_runs.countThe number of flex runs used in the current billing period
scalr.billing.flex_run_minutes.countThe 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:


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:

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

Here is an example of a full log output:

	"content": {
		"timestamp": "2024-02-16T12:58:38.577Z",
		"tags": [
			"scalr-user-email:[email protected]",
		"host": "",
		"service": "audit-log",
		"attributes": {
			"actor": {
				"id": "user-stp8qjepev3a123",
				"access-token": {
					"type": "session",
					"token": "...B6wifA"
				"type": "user",
				"email": "[email protected]"
			"request": {
				"ip-address": "",
				"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/ Safari/537.36"
			"hostname": "",
			"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"