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

Sources

Practice in the labs

Write your first rules, then use the Detection Lab to test them against incident evidence.

Also try, in the simulators

Knowledge check

  1. 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.
  2. 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.
  3. 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.

Related