Detection Engineering with Sigma
Write, test and maintain detection rules as code using the vendor-neutral Sigma format and convert them for your SIEM.
Advanced · about 12 hours · difficulty 4/5
Learn first: Log Analysis and Alert Triage, Git and GitHub for Security Work
Detection engineering treats alert rules like software: written deliberately, version controlled, tested and improved. Sigma is an open, YAML-based rule format that describes suspicious log patterns once and converts them to Splunk, Elastic, Microsoft Sentinel and other backends.
Anatomy of a Sigma rule
title,id,status,description,author,references.logsource: product, category and service, for example Windows process creation.detection: named selections of field conditions plus aconditionline combining them.falsepositivesandlevelso analysts know what to expect.tagsmapping to MITRE ATT&CK techniques.
The engineering loop
- Start from a behaviour you want to catch, often an ATT&CK technique relevant to you.
- Confirm you have the log source and fields needed.
- Write the rule, convert it with pySigma / sigma-cli, and run it against lab data that contains both the behaviour and normal activity.
- Tune: add filters for known benign cases rather than weakening the whole rule.
- Store in Git, peer review changes, and track which rules fire and how often.
Quality signals
- Clear title and triage guidance.
- Tested against real benign data.
- Resilient to trivial changes (not just one exact filename).
Pitfalls
- Rules that depend on fields your pipeline does not collect.
- Copying community rules without testing, then disabling them when they get noisy.
Move on when you can write a Sigma rule for a suspicious process pattern, convert it for your SIEM and show it firing on lab data.
Key concepts
- Detection-as-code mindset
- Sigma rule structure
- logsource and detection logic
- Converting with sigma-cli / pySigma
- Testing with lab data
- Tuning and filters
- Rule review in Git
- Detection coverage tracking
Mini project
Write three Sigma rules for Windows process-creation behaviours you care about, convert them to your SIEM query language, test against benign lab data, and publish them with notes in a Git repo.
Check yourself
Why is adding a narrow filter for a known benign case better than loosening the whole detection?
Free resources
- Sigma documentation (SigmaHQ)
- SigmaHQ rule repository (SigmaHQ)
- sigma-cli (SigmaHQ)