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

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
H
Hacker News: Front Page
P
Palo Alto Networks Blog
T
ThreatConnect
Apple Machine Learning Research
Apple Machine Learning Research
博客园_首页
T
True Tiger Recordings
P
Privacy & Cybersecurity Law Blog
B
Blog
IT之家
IT之家
Last Week in AI
Last Week in AI
F
Full Disclosure
Hacker News: Ask HN
Hacker News: Ask HN
C
Comments on: Blog
Microsoft Azure Blog
Microsoft Azure Blog
C
Cybersecurity and Infrastructure Security Agency CISA
Microsoft Security Blog
Microsoft Security Blog
博客园 - 【当耐特】
N
News and Events Feed by Topic
NISL@THU
NISL@THU
腾讯CDC
雷峰网
雷峰网
Security Latest
Security Latest
李成银的技术随笔
M
Microsoft Research Blog - Microsoft Research
L
LangChain Blog
L
Lohrmann on Cybersecurity
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
C
Check Point Blog
Y
Y Combinator Blog
Recent Announcements
Recent Announcements
博客园 - Franky
N
News | PayPal Newsroom
V
V2EX
A
About on SuperTechFans
The Register - Security
The Register - Security
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google Online Security Blog
Google Online Security Blog
MyScale Blog
MyScale Blog
Cisco Talos Blog
Cisco Talos Blog
Vercel News
Vercel News
WordPress大学
WordPress大学
C
Cyber Attacks, Cyber Crime and Cyber Security
The Hacker News
The Hacker News
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
爱范儿
爱范儿
A
Arctic Wolf
L
LINUX DO - 最新话题
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

Datadog | The Monitor blog

Reduce CVE noise with OpenVEX assessments in Datadog How we made a SQL query optimization agent 59% more accurate using autoresearch and LLM Observability How to audit and clean up monitors effectively Diagnose slow PostgreSQL queries faster with explain plan correlation Explore Datadog metrics with Natural Language Queries Toto 2.0: Time series forecasting enters the scaling era Simplify micro-frontend observability with Datadog RUM Attribute AI costs across providers with Datadog Cloud Cost Management Diagnose and resolve database performance issues faster with Database Investigator Datadog for Government achieves FedRAMP® High certification Analyze cloud costs with flexible spreadsheets in Datadog Sheets Inside Datadog’s AI Research Lab: Meet two PhD candidates behind Toto Connect triage and investigation in a single workflow with Datadog Cloud SIEM This Month in Datadog - April 2026 Monitor and optimize Supabase query performance with Datadog Database Monitoring Add dynamically updating context to logs with Reference Tables and Observability Pipelines Introducing ARFBench: A time series question-answering benchmark based on real incidents The product signal latency gap slowing your growth Test network paths with TCP, UDP, and ICMP in Datadog Turn developer feedback into operational insight with Datadog Forms and Sheets How to investigate cloud credential compromise with Bits AI Security Analyst Evaluate, optimize, and secure your Google Cloud AI stack with Datadog Bringing observability data hosting to the UK on AWS Identify and fix code issues faster with Datadog’s Azure DevOps Source Code integration Steganography at scale: Embedding share URLs in Datadog widget screenshots Every team should be A/B testing Centralize observability management with Datadog Governance Console Spotting CI/CD misconfigurations before the bots do: Securing GitHub Actions with Datadog IaC Security Route OTel data from AI apps to ClickHouse and Datadog using Observability Pipelines Manage service tracing across hosts with Single Step Instrumentation rules Offline evaluation for AI agents: Best practices Detect runtime threats in Python Lambda functions with Datadog AAP 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 How we built a real-world evaluation platform for autonomous SRE agents at scale 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 When upserts don't update but still write: Debugging Postgres performance at scale 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 Closing the verification loop: Observability-driven harnesses for building with agents When an AI agent came knocking: Catching malicious contributions in Datadog’s open source repos Closing the verification loop, Part 2: Fully autonomous optimization 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 Designing MCP tools for agents: Lessons from building Datadog's MCP server 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 Fine-tune Toto for turbocharged forecasts 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 How we reduced the size of our Agent Go binaries by up to 77% 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
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