惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

GbyAI
GbyAI
博客园 - 三生石上(FineUI控件)
S
Securelist
U
Unit 42
The Cloudflare Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Simon Willison's Weblog
Simon Willison's Weblog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
B
Blog
T
Tenable Blog
The Hacker News
The Hacker News
The Register - Security
The Register - Security
IT之家
IT之家
博客园 - 【当耐特】
Spread Privacy
Spread Privacy
P
Privacy & Cybersecurity Law Blog
博客园_首页
T
Tailwind CSS Blog
人人都是产品经理
人人都是产品经理
C
Cybersecurity and Infrastructure Security Agency CISA
Know Your Adversary
Know Your Adversary
NISL@THU
NISL@THU
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
阮一峰的网络日志
阮一峰的网络日志
T
Tor Project blog
C
CERT Recently Published Vulnerability Notes
Apple Machine Learning Research
Apple Machine Learning Research
Stack Overflow Blog
Stack Overflow Blog
T
Threat Research - Cisco Blogs
T
The Exploit Database - CXSecurity.com
V
Vulnerabilities – Threatpost
A
Arctic Wolf
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
V
V2EX
aimingoo的专栏
aimingoo的专栏
大猫的无限游戏
大猫的无限游戏
Scott Helme
Scott Helme
L
LINUX DO - 热门话题
Cyberwarzone
Cyberwarzone
V
Visual Studio Blog
月光博客
月光博客
爱范儿
爱范儿
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
美团技术团队
G
GRAHAM CLULEY
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
H
Heimdal Security Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO

Datadog | The Monitor blog

Introducing our open source AI-native SAST Instrument and monitor Boomi integration flows with OpenTelemetry and Datadog Not all index scans are equal: How we cut query latency by over 99% Platform engineering metrics: What to measure and what to ignore Integrate Recorded Future threat intelligence with Datadog Cloud SIEM CI/CD security: threat modeling using a MITRE-style threat matrix CI/CD security: How to secure your GitHub ecosystem Ingress NGINX is EOL: A practical guide for migrating to Kubernetes Gateway API Operating agentic AI with Amazon Bedrock AgentCore and Datadog LLM Observability: Lessons from NTT DATA Introducing the Datadog Code Security MCP Capture and analyze custom heatmaps in Session Replay Understand session replays faster with AI summaries and smart chapters Monitor ClickHouse query performance with Datadog Database Monitoring How we designed empathetic alert sounds for on-call engineers Search and act across Datadog to resolve issues faster with Bits Assistant Measure the business impact of every product change with Datadog Experiments Analyzing round trip query latency Configuring JavaScript caches for better performance Introducing Bits AI Dev Agent for Code Security Datadog achieves ISO 42001 certification for responsible AI Monitor Nutanix clusters, hosts, and VMs with Datadog Monitor Juniper Mist in Datadog A new Host Map for modern infrastructure Annotate traces to improve LLM quality with Datadog LLM Observability What’s new in Cloud SIEM: AI-powered investigations, enhanced threat intelligence, and scalable security operations Explore Kubernetes with native OpenTelemetry data Monitor Oracle Fusion Cloud Applications with Datadog Announcing the Datadog Terraform provider v4.0.0 Scaling Kubernetes workloads on custom metrics How to design cloud environments for AI-powered threat analysis Monitor Aruba Central in Datadog How we centralize and remediate risks with Datadog Case Management Accelerate incident response with Datadog and ServiceNow Monitor your application and network load balancer logs Understanding Karpenter architecture for Kubernetes autoscaling Tools for collecting metrics and logs from Karpenter Monitor Karpenter with Datadog What your product data is actually saying Key metrics for monitoring Karpenter Securing Datadog’s platform in the AI age: The role of observability data Four ways engineering teams use the Datadog MCP Server to power AI agents Approaching your observability migration with the right mindset Meet the new Bits AI SRE: Deeper reasoning, twice as fast Key learnings from the 2026 State of DevSecOps study Use plain English to query your multi-cloud infrastructure in Resource Catalog Simplifying troubleshooting across the user journey with Datadog Synthetic Monitoring Protect your OCI resources with Datadog Cloud Security This Month in Datadog - February 2026 Amazon EC2 security: How misconfigured and public AMIs expand your cloud attack surface Enable end-to-end visibility into your Java apps with a single command Measure and improve mobile app startup performance with Datadog RUM Evaluating our AI Guard application to improve quality and control cost Identify untested code across every level of your codebase Make use of guardrail metrics and stop babysitting your releases Monitor Versa Networks SD-WAN performance in Datadog Improve performance and reliability with APM Recommendations Remediate transitive vulnerabilities faster with Datadog Software Composition Analysis Generate audit-ready vulnerability and compliance reports with Datadog Sheets Monitor Fortinet FortiManager performance in Datadog Improve test coverage across codebases with Datadog Code Coverage Move fast, don’t break things: Consistent testing standards at scale Enrich logs with ServiceNow CMDB context before routing to any SIEM or logging tool Monitor Lustre with Datadog Make faster, better product decisions with Datadog Product Analytics Surface and remediate runtime posture issues with Workload Protection Findings Protect agentic AI applications with Datadog AI Guard How to optimize JavaScript code with CSS Trace Google Pub/Sub workloads in Cloud Run with Datadog Detect human names in logs with ML in Sensitive Data Scanner How we cut our NLQ agent debugging time from hours to minutes with LLM Observability Debug PostgreSQL query latency faster with EXPLAIN ANALYZE in Datadog Database Monitoring Datadog acquires Propolis Unify and correlate frontend and backend data with retention filters Scale compliance across global frameworks with Datadog Cloud Security Monitor Arista VeloCloud SD-WAN performance with Datadog Building reliable dashboard agents with Datadog LLM Observability Simplify log collection and aggregation for MSSPs with Datadog Observability Pipelines Mitigation for Node.js denial-of-service vulnerability affecting Datadog APM Automate flaky test fixes with the Bits AI Dev Agent and Test Optimization How we built an AI SRE agent that investigates like a team of engineers Datadog integrations 2025 recap: Observability for AI, security, and hybrid cloud Design effective executive dashboards with Datadog Implement dbt data quality checks with dbt-expectations Bring faster visibility into AWS Lambda functions with remote instrumentation Troubleshoot faster with the GitLab Source Code integration in Datadog How Cambia Health Solutions saved $30,000 monthly with Cloud Cost Management and the Datadog Resource Catalog Normalize any logs for Cloud SIEM with Datadog's OCSF processor Optimizing Datadog at scale: Cost-efficient observability at Zendesk Detect, diagnose, and resolve network issues easily with CNM Network Health Connect engineering errors to user impact in early-stage products Cilium configuration for Kubernetes operations at scale Designing feedback loops for progressive delivery Ship features faster and safer with Datadog Feature Flags Choosing the right OpenTelemetry Collector distribution Route your monitor alerts with Datadog monitor notification rules Automate Cloud SIEM investigations with Bits AI Security Analyst Cloud threat detection: How to identify risky activity across control and data planes Collecting Kafka performance metrics Monitoring Kafka with Datadog Monitoring Kafka performance metrics
Build, test, and scale detections as code with Datadog Cloud SIEM
2025-06-11 · via Datadog | The Monitor blog
Nimisha Saxena

Nimisha Saxena

Clement Gaboriau Couanau

Clement Gaboriau Couanau

Security teams often struggle to keep up with rapidly evolving threats, especially when they have to manually manage detection rules. Without automation or version control, it’s difficult to maintain consistency across environments, track changes, or deploy updates quickly.

Datadog Cloud SIEM supports detection as code, a structured approach to authoring, testing, deploying, and managing detection rules using code and infrastructure-as-code tools like Terraform. This enables teams to automate rule workflows, minimize human error, and integrate seamlessly with CI/CD pipelines.

In this post, we’ll walk through key aspects of implementing detection as code with Datadog Cloud SIEM:

Validate rule format with linting

Before deploying a detection rule, it’s important to ensure that it adheres to Datadog’s expected structure. Linting enables you to catch format and schema issues early in the development process.

You can use the Datadog API to submit detection rules for validation. This step helps ensure that only well-formed rules progress through your pipeline. In the example below, we attempt to validate a rule to detect unexpected external access to Snowflake tables. The rule fails due to an invalid value for the duration after which a learned value is forgotten (options.newValueOptions.forgetAfter).

curl https://api.datadoghq.com/api/v2/security_monitoring/rules/validation -H "DD-API-KEY: $DD_API_KEY" -H "DD-APPLICATION-KEY: $DD_APP_KEY" -H "Content-Type: application/json" --data '{

"name": "Snowflake external access occurred",

"isEnabled": true,

"queries": [

{

"query": "source:snowflake snowflake.table:external_access",

"groupByFields": [

"@network.client.ip"

],

"hasOptionalGroupByFields": false,

"distinctFields": [],

"metric": "@network.client.ip",

"metrics": [

"@network.client.ip"

],

"aggregation": "new_value",

"name": "",

"dataSource": "logs"

}

],

"options": {

"evaluationWindow": 0,

"detectionMethod": "new_value",

"maxSignalDuration": 86400,

"keepAlive": 3600,

"newValueOptions": {

"forgetAfter": 34,

"learningDuration": 7,

"learningThreshold": 0,

"learningMethod": "duration"

},

"decreaseCriticalityBasedOnEnv": true

},

"cases": [

{

"name": "",

"status": "medium",

"notifications": []

}

],

"message": "## Goal\n\nDetect when an external access event occurs in your Snowflake environment.\n\",

"tags": [

"scope:snowflake",

"technique:T1199-trusted-relationship",

"mitre_platform:saas",

"source:snowflake",

"team:cloud-siem",

"security:attack",

"tactic:TA0001-initial-access",

"mitre_platform:cloud"

],

"hasExtendedTitle": true,

"type": "log_detection",

"filters": []

}'

{"error":{"code":"InvalidArgument","message":"Invalid rule configuration","details":[{"code":"InvalidArgument","message":"forgetAfter value is invalid. Maximum allowed value (in days): 30","target":"forgetAfter"}]}

Automated validation eliminates the need for manual checks, making your workflow more efficient and less error-prone.

Test detection rules against mock and log data

Once rules are linted, testing them helps confirm that they behave as expected, without triggering false positives or missing actual threats. With the Datadog API, you can unit test rules with mock data, or run them against historical logs to test them in real-world situations.

Unit testing with mock data

You can use the test-a-rule API to validate a rule’s query logic (rather than the case logic) against mock data in isolation before using real log data. The response will contain the assert results, which are returned in the same order as the rule query payloads. For each payload, it returns true if the result matches the expectedResult value, false otherwise.

In the below example, we are sending three query payloads to test query logic that looks for logs sent from the source my-source and that contain a host tag.

curl https://api.datadoghq.com/api/v2/security_monitoring/rules/test -H "DD-API-KEY: $DD_API_KEY" -H "DD-APPLICATION-KEY: $DD_APP_KEY" -H "Content-Type: application/json" --data '

{

"rule":

{

"cases":

[

{

"condition": "a > 5",

"name": "High count",

"notifications":

[],

"status": "high"

}

],

"isEnabled": true,

"name": "Test Threshold Rule",

"message": "Test Threshold Rule",

"options":

{

"evaluationWindow": 900,

"keepAlive": 3600,

"maxSignalDuration": 86400

},

"queries":

[

{

"aggregation": "count",

"distinctFields":

[],

"groupByFields":

[

"host"

],

"name": "a",

"query": "source:my-source"

}

],

"tags":

[],

"type": "log_detection"

},

"ruleQueryPayloads":

[

{

"expectedResult": true,

"index": 0,

"payload":

{

"ddsource": "my-source",

"host": "i-9399",

"tags": []

}

},

{

"expectedResult": false,

"index": 0,

"payload":

{

"ddsource": "not-my-source",

"host": "i-9399",

"tags": []

}

},

{

"expectedResult": false,

"index": 0,

"payload":

{

"ddsource": "my-source",

"tags": []

}

}

]

}'

{"results":[true,true,true]}

Our first payload includes a host tag and queries the correct my-source log source and so we expect a return of true. The second payload has a host tag but queries an incorrect log source, and so the expected result is false. The final payload has the correct source but no host tag, and so should also return false. As we can see in the results (true,true,true), each of our expected results was correct.

Mock data enables rapid feedback cycles, helping you fix logic errors early in the rule development process.

Back testing with historical data

To understand how a rule performs under real-world conditions, you can back test it against historical logs using the run-a-historical-job API. The below command runs an historical job on the rule with the ID nr5-nrp-9dm using logs from the logs index github-audit-logs across a specified one-hour time range. The command returns the ID of the newly created Historical Job a9d2c2e5-cec4-466c-885e-d170a29ec94d.

curl https://app.datadoghq.com/api/v2/siem-historical-detections/jobs -H "DD-API-KEY: $DD_API_KEY" -H "DD-APPLICATION-KEY: $DD_APP_KEY" -H "Content-Type: application/json" --data '

{

"data":

{

"type": "historicalDetectionsJobCreate",

"attributes":

{

"fromRule":

{

"from": 1748002971780,

"to": 1748006571827,

"index": "github-audit-logs",

"id": "nr5-nrp-9dm",

"notifications":

[]

}

}

}

}'

{"data":{"id":"a9d2c2e5-cec4-466c-885e-d170a29ec94d","type":"historicalDetectionsJob"}}

This approach surfaces insights about how a rule would have behaved during past incidents, helping you fine-tune its effectiveness and reduce noise.

Convert detection rules to Terraform

Datadog detection rules are defined in JSON, but managing them as Terraform code makes it easier to standardize deployments and track changes. You can easily export a rule to Terraform from the Datadog UI.

Menu option for exporting detection rule to Terraform

Alternatively, the convert-a-rule-from-json-to-terraform API transforms a JSON rule into Terraform syntax. In the following example, we’re converting our Snowflake external access detection rule (after having corrected the forgetAfter value).

curl https://api.datadoghq.com/api/v2/security_monitoring/rules/convert -H "DD-API-KEY: $DD_API_KEY" -H "DD-APPLICATION-KEY: $DD_APP_KEY" -H "Content-Type: application/json" --data '{

"name": "Snowflake external access occurred",

"isEnabled": true,

"queries": [

{

"query": "source:snowflake snowflake.table:external_access",

"groupByFields": [

"@network.client.ip"

],

"hasOptionalGroupByFields": false,

"distinctFields": [],

"metric": "@network.client.ip",

"metrics": [

"@network.client.ip"

],

"aggregation": "new_value",

"name": "",

"dataSource": "logs"

}

],

"options": {

"evaluationWindow": 0,

"detectionMethod": "new_value",

"maxSignalDuration": 86400,

"keepAlive": 3600,

"newValueOptions": {

"forgetAfter": 28,

"learningDuration": 7,

"learningThreshold": 0,

"learningMethod": "duration"

},

"decreaseCriticalityBasedOnEnv": true

},

"cases": [

{

"name": "",

"status": "medium",

"notifications": []

}

],

"message": "## Goal\n\nDetect when an external access event occurs in your Snowflake environment.\n\n## Strategy\n\nThis rule allows you to detect when a new external access event occurs in Snowflake. Review any suspicious entries of external access performed by procedure or user-defined function (UDF) handler code within the last 365 days through the External Access History table. Unexpected use of external access for your environment is a potential indicator of compromise.\n\n## Triage and response\n\n1. Inspect the logs to identify the source cloud, source region, target cloud, target region, and query ID.\n2. Investigate whether the source and target cloud locations are expected.\n3. Using the query ID, correlate the behavior with Query History logs to determine the user, query, and other useful information.\n4. If there are signs of compromise, disable the user associated with the external access integration and rotate credentials.\n",

"tags": [

"scope:snowflake",

"technique:T1199-trusted-relationship",

"mitre_platform:saas",

"source:snowflake",

"team:cloud-siem",

"security:attack",

"tactic:TA0001-initial-access",

"mitre_platform:cloud"

],

"hasExtendedTitle": true,

"type": "log_detection",

"filters": []

}' | jq -r '.terraformContent'

resource "datadog_security_monitoring_rule" "snowflake_external_access_occurred" {

name = "Snowflake external access occurred"

enabled = true

query {

query = "source:snowflake snowflake.table:external_access"

group_by_fields = ["@network.client.ip"]

distinct_fields = []

metric = "@network.client.ip"

metrics = ["@network.client.ip"]

aggregation = "new_value"

name = ""

data_source = "logs"

}

options {

keep_alive = 3600

max_signal_duration = 86400

detection_method = "new_value"

evaluation_window = 0

new_value_options {

forget_after = 28

learning_duration = 7

learning_threshold = 0

learning_method = "duration"

}

decrease_criticality_based_on_env = true

}

case {

name = ""

status = "medium"

notifications = []

}

message = "## Goal\\n\\nDetect when an external access event occurs in your Snowflake environment.\\n\\n## Strategy\\n\\nThis rule allows you to detect when a new external access event occurs in Snowflake. Review any suspicious entries of external access performed by procedure or user-defined function (UDF) handler code within the last 365 days through the External Access History table. Unexpected use of external access for your environment is a potential indicator of compromise.\\n\\n## Triage and response\\n\\n1. Inspect the logs to identify the source cloud, source region, target cloud, target region, and query ID.\\n2. Investigate whether the source and target cloud locations are expected.\\n3. Using the query ID, correlate the behavior with Query History logs to determine the user, query, and other useful information.\\n4. If there are signs of compromise, disable the user associated with the external access integration and rotate credentials.\\n"

tags = ["scope:snowflake","technique:T1199-trusted-relationship","mitre_platform:saas","source:snowflake","team:cloud-siem","security:attack","tactic:TA0001-initial-access","mitre_platform:cloud"]

has_extended_title = true

type = "log_detection"

}

Storing detection rules as code enables you to integrate with source control, review changes via pull requests, and deploy consistently across environments.

Deploy rules via API or Terraform

After validating and testing your rules, Datadog offers two deployment methods: direct API submission or Terraform.

Use the create-a-detection-rule API for dynamic deployments, or manage infrastructure-as-code with the security_monitoring_rule Terraform resource.

Both methods support automation and can be integrated into CI/CD pipelines, ensuring fast, repeatable deployments with minimal manual steps.

Track and manage rule changes with versioning

As detection rules evolve, it’s critical to maintain visibility into how and when they change. Datadog’s rule versioning API lets you audit the history of a rule, including its updates and authors.

curl https://app.datadoghq.com/api/v2/security_monitoring/rules/el5-khj-p4i/version_history\?page%5Bsize%5D\=10\&page%5Bnumber%5D\=0 -H "DD-API-KEY: $DD_API_KEY" -H "DD-APPLICATION-KEY: $DD_APP_KEY" -H "Content-Type: application/json"

{

"data":

{

"id": "el5-khj-p4i",

"type": "GetRuleVersionHistoryResponse",

"attributes":

{

"count": 2,

"data":

{

"1":

{

"rule":

{

"name": "[CGC] High number of operation on security assets",

"createdAt": 1745075545230,

"isDefault": false,

"isPartner": false,

"isEnabled": true,

"isBeta": false,

"isDeleted": false,

"isDeprecated": false,

"queries":

[

{

"query": "@asset.type:security_rule @usr.email:*@datadoghq.com",

"groupByFields":

[

"@usr.id"

],

"hasOptionalGroupByFields": false,

"distinctFields":

[],

"aggregation": "count",

"name": "",

"dataSource": "audit"

}

],

"options":

{

"evaluationWindow": 900,

"detectionMethod": "threshold",

"maxSignalDuration": 86400,

"keepAlive": 3600

},

"cases":

[

{

"name": "Condition 1",

"status": "medium",

"notifications":

[],

"condition": "a> 15"

},

{

"name": "Condition 2",

"status": "low",

"notifications":

[],

"condition": "a> 10"

},

{

"name": "Condition 3",

"status": "info",

"notifications":

[],

"condition": "a> 5"

}

],

"message": "High number of operation on security assets",

"tags":

[],

"hasExtendedTitle": true,

"type": "log_detection",

"filters":

[],

"version": 1,

"id": "el5-khj-p4i",

"blocking": false,

"metadata":

{

"entities": null,

"sources": null

},

"creationAuthorId": 3746826,

"creator":

{

"handle": "clement.gaboriaucouanau",

"name": "Clément Gaboriau Couanau"

},

"updater":

{

"handle": "",

"name": ""

}

},

"changes":

[]

},

"2":

{

"rule":

{

"name": "[CGC] High number of operation on security assets",

"createdAt": 1745075545230,

"isDefault": false,

"isPartner": false,

"isEnabled": true,

"isBeta": false,

"isDeleted": false,

"isDeprecated": false,

"queries":

[

{

"query": "@asset.type:security_rule @usr.email:*@datadoghq.com",

"groupByFields":

[

"@usr.id"

],

"hasOptionalGroupByFields": false,

"distinctFields":

[],

"aggregation": "count",

"name": "",

"dataSource": "audit"

}

],

"options":

{

"evaluationWindow": 900,

"detectionMethod": "threshold",

"maxSignalDuration": 86400,

"keepAlive": 3600

},

"cases":

[

{

"name": "Condition 1",

"status": "medium",

"notifications":

[],

"condition": "a> 15"

},

{

"name": "Condition 2",

"status": "low",

"notifications":

[],

"condition": "a> 10"

},

{

"name": "Condition 3",

"status": "info",

"notifications":

[],

"condition": "a> 5"

}

],

"message": "High number of operation on security assets",

"tags":

[

"team:cloud-siem",

"source:audit-trail"

],

"hasExtendedTitle": true,

"type": "log_detection",

"filters":

[],

"version": 2,

"id": "el5-khj-p4i",

"updatedAt": 1747782170877,

"blocking": false,

"metadata":

{

"entities": null,

"sources": null

},

"creationAuthorId": 3746826,

"updateAuthorId": 3746826,

"creator":

{

"handle": "clement.gaboriaucouanau",

"name": "Clément Gaboriau Couanau"

},

"updater":

{

"handle": "clement.gaboriaucouanau",

"name": "Clément Gaboriau Couanau"

}

},

"changes":

[

{

"type": "CREATE",

"field": "Tags",

"change": "source:audit-trail"

},

{

"type": "CREATE",

"field": "Tags",

"change": "team:cloud-siem"

}

]

}

}

}

}

}

Versioning supports compliance, debugging, and collaboration, especially in environments where multiple teams contribute to rule development.

Manage detection at scale with CI/CD

Scaling detection across environments requires consistent processes and automated tooling. Datadog enables this with robust API support, a Terraform integration, and compatibility with CI/CD systems.

This approach allows large teams to operate efficiently and with confidence—ensuring that security coverage keeps pace with evolving infrastructure.

Start managing detection as code with Datadog Cloud SIEM

Detection as code helps security teams move faster, reduce errors, and maintain clarity over their detection rules. With Datadog Cloud SIEM, you can build, test, and scale your detection strategy using automation and infrastructure as code.

To learn more, explore our API documentation and Terraform resources.

Ready to get started? 14-day free trial