Rules that read logs: Sigma
Unit 2 of 5 in Logging and detection.
You will be able to read a Sigma rule and say what its detection, log source and metadata parts do.
Lesson
One rule format for many tools
Every log search tool has its own query language, which makes rules hard to share. Sigma is an open format for writing detection rules in YAML. A single rule converts into a query for whichever tool you run, such as Splunk, Elasticsearch, Microsoft Sentinel or Grafana Loki. The documentation says this makes detections portable, vendor-neutral and easy to share.
Think of Sigma as a recipe card: it says what to look for and where, and a converter writes it out for your kitchen.
Three parts of a rule
The Sigma documentation splits every rule into three components. The detection says what malicious behaviour the rule is searching for, and it is the most important component. The log source says what types of logs the rule should search over, such as the product and service. The metadata holds other information about the detection.
A tiny example in the documentation looks for an Okta account locked out after too many sign-in attempts: the log source names the product and service, the detection is one selection matching a particular message, and the condition says the rule fires when that selection matches.
Selections and conditions
Inside the detection, a selection is a named group of field matches, and the condition combines selections with boolean operations such as and, or and not. This is how a rule says 'a command shell started by the accounting updater' without matching every shell on the network.
The documentation notes that Sigma detections can look daunting to newcomers because some are complex, and gives principles to read them: start with the selections, then read the condition that combines them. The conditions page adds that the condition field can also filter out known false positives.
Say what is likely to go wrong
The example rule includes a field for false positives, the legitimate activity that could also match. Writing it down is a habit worth copying: the person who gets the alert needs to know what harmless events look like. The next units show how to measure that noise instead of guessing.
Key points
- Sigma is an open YAML format that converts to many tools' queries.
- A rule has a detection, a log source and metadata.
- Selections are groups of field matches; the condition combines them.
- Record the likely false positives in the rule itself.
Sources
Practice in the labs
Write your first rules, then use the Detection Lab to test them against incident evidence.
- Write your first Sigma detection rule: You write Sigma rules from scratch for common behaviours.
- Set up Sysmon for endpoint detection on your own Windows machine: You turn on the endpoint sensor that produces the process events many rules read.
Also try, in the simulators
- Sigma: one rule format for logs (Detection Lab lesson): The Detection Lab course lesson on Sigma, with the rule format explained step by step.
- Find the accounting updater starting a command shell (Detection Lab task): You write a rule that finds the accounting updater starting a command shell, a classic parent and child process detection.
- Catch the web server writing a new page file (Detection Lab task): You write a rule that catches the web server writing a new page file, from a real incident.
Knowledge check
- What are the three main components of a Sigma rule? Answer: Detection, log source and metadata. The Sigma documentation splits a rule into detection, logsource and metadata.
- Why is Sigma portable? Answer: One rule converts into queries for many different tools. Sigma is an open YAML format that converts into queries for tools such as Splunk, Elasticsearch and Sentinel.
- Why note likely false positives inside a rule? Answer: So the person who gets the alert knows what harmless matches look like. Sigma rules carry a falsepositives field; recording it helps triage and later tuning.
Back to the syllabus or see all classes.