Incident Detection and Triage · Topic 4 of 6
Using AI to Generate SIEM Rules
Learn how SOC teams use generative AI to draft SIEM detection rules, the risks involved, and how to validate and test AI drafts before use for CSA 312-39.
- 5 min
- AI speeds up drafting, translating and explaining rules, but its output is a draft.
- Hallucinated fields and event IDs are the most common failure.
- Every AI draft goes through the normal use case lifecycle: review, test, tune, document.
What it is
Writing detection rules takes skill and time. Analysts must know the attack, the log fields and the rule language of their SIEM. Generative AI, through large language models (LLMs), can draft a rule from a plain language request such as "alert when the Security log is cleared on any server."
The AI produces a draft, not a finished control. A detection engineer must review, test and tune it before it goes into production.
How it works
Where AI helps
| Task | How AI helps |
|---|---|
| Drafting rules | Turns a described behavior into rule logic in a SIEM's language or a vendor neutral format such as Sigma |
| Translating rules | Converts a rule from one SIEM's language to another during migration |
| Explaining rules | Describes in plain words what an existing rule detects |
| Mapping to frameworks | Suggests the MITRE ATT&CK technique a rule covers |
| Suggesting tuning | Proposes exclusions after seeing false positive examples |
| Coverage ideas | Lists behaviors for a technique that the SOC does not yet detect |
Many SIEM and XDR products now include an AI assistant for these tasks. General purpose LLMs can also be used, subject to company policy on data sharing.
Sigma as a common target
Sigma is an open, vendor neutral format for writing detection rules in YAML. A Sigma rule can be converted to many SIEM query languages, so it is a useful format for an AI to draft in. Here is a minimal valid Sigma rule for a cleared Security log:
title: Security Event Log Cleared
status: experimental
description: Detects clearing of the Windows Security event log
logsource:
product: windows
service: security
detection:
selection:
EventID: 1102
condition: selection
level: high
The parts are: what logs to look at (logsource), what to match (detection), when to fire (condition), and how serious it is (level).
Risks of AI generated rules
| Risk | What can go wrong |
|---|---|
| Hallucination | The model invents a field name, event ID or function that does not exist, so the rule never matches |
| Wrong logic | Conditions joined with the wrong operator, causing the rule to fire on everything or nothing |
| Environment mismatch | Field names differ from how the SOC's SIEM actually parses its logs |
| Too broad | Generic logic floods analysts with false positives |
| Too narrow | Logic tied to one sample misses variants of the same behavior |
| Data exposure | Pasting real logs with usernames, addresses or secrets into an external AI service |
| Over trust | Analysts deploy without testing because the output "looks right" |
Validating an AI draft
- Read the logic. Confirm each condition matches the intended behavior.
- Check fields and IDs. Verify every field name against the SIEM's actual schema and every event ID against official documentation.
- Test positive cases. Replay or safely simulate the attack and confirm the rule fires.
- Test negative cases. Run it against normal historical data and count false positives.
- Tune. Add thresholds, grouping and exclusions.
- Document and own. Record the objective, ATT&CK mapping, author, reviewer and review date, as with any use case.
A worked example
An analyst asks an AI assistant for a rule that detects new services installed on servers. The draft looks for event 4697 in the System log.
The reviewer checks the documentation. Event 7045 is the service install event in the System log, while 4697 is a Security log event that only appears when its audit setting is on. The reviewer fixes the log source, confirms the SOC collects the needed log, replays a test service install, and only then promotes the rule.
How the exam asks about this
- "What is the main risk of deploying an AI generated SIEM rule without review?" → It may contain invented fields or wrong logic and fail to detect, or flood the SOC with false positives.
- "Which vendor neutral rule format is commonly used to share detections across SIEMs?" → Sigma.
- "Before using a public AI service to draft a rule from sample logs, what should the analyst do?" → Remove or mask sensitive data and follow the organization's AI use policy.
What to remember for the exam
- AI speeds up drafting, translating and explaining rules, but its output is a draft.
- Hallucinated fields and event IDs are the most common failure.
- Every AI draft goes through the normal use case lifecycle: review, test, tune, document.
- Test both that the rule fires on the attack and that it stays quiet on normal data.
- Do not paste sensitive logs into external AI tools without approval and masking.
A rule that never fires is worse than no rule, because the SOC believes it has coverage. Always prove an AI draft detects the behavior before relying on it.
Common mistakes
Trusting syntax as proof of correctness. A rule can be perfectly valid and still match nothing because the field names are wrong for that SIEM.
Skipping negative testing. Without testing against normal data, a broad AI draft can produce hundreds of false positives on day one.
Leaving no human owner. AI does not maintain the rule. Someone must own tuning and review like any other use case.
Check yourself
What is a hallucination in an AI generated SIEM rule?
The AI invents something that does not exist, such as a field name, event ID or function, so the rule is wrong.
Why is Sigma useful when drafting rules with AI?
It is an open, vendor neutral YAML format that can be converted to many SIEM query languages.
What two kinds of test should an AI draft pass?
It must fire when the target behavior is simulated, and stay quiet on normal historical data.
Topic 4 of 6 in Incident Detection and Triage
Test yourself on Incident Detection and Triage
The full EC-Council 312-39 question bank has 700 questions, with timed practice exams and an explanation for every answer.
This study guide is independent and is not affiliated with, endorsed by, or sponsored by EC-Council. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.