Sigma Rules: A Practical Guide to Writing Detections That Don't Drown the SOC

Sigma is an open, vendor-neutral format for writing log detections once and running them on any SIEM. This guide covers how a rule is put together, how it becomes a Splunk, Sentinel or Elastic query, and the parts of the format that decide whether it catches attackers or just pages analysts.

By the Security Monitoring Review editors · Updated

What a Sigma rule is

A Sigma rule is a YAML file that describes suspicious activity in log data: which logs to look at, which field values to match, and how to combine the matches. It says nothing about any one product's query syntax. A converter turns it into SPL, KQL, Lucene, ES|QL or another backend's language when you deploy it.

That separation is the point. Detection logic written in one SIEM's dialect is locked to that SIEM; the same logic as Sigma can be reviewed, versioned and shared like code, then compiled for whatever platform a team runs this year. It is the format most detection-as-code pipelines are built around.

The project lives on GitHub under the SigmaHQ organisation: the format specification (SigmaHQ/sigma-specification), the community rule set (SigmaHQ/sigma), the pySigma conversion library and the sigma-cli command-line tool.

Anatomy of a rule

The rule below flags certutil.exe, a signed Windows binary, being used to download a file — a common way to pull a payload onto a host without dropping a new tool.

title: Certutil Used to Download a File
id: 4a833d7e-899e-4a46-a440-a112302c16f7
status: experimental
description: Detects certutil.exe run with its URL cache option against an HTTP(S) address.
references:
  - https://attack.mitre.org/techniques/T1105/
author: Security Monitoring Review
date: 2026-11-16
tags:
  - attack.command-and-control
  - attack.t1105
logsource:
  category: process_creation
  product: windows
detection:
  selection_img:
    - Image|endswith: '\certutil.exe'
    - OriginalFileName: 'CertUtil.exe'
  selection_cli:
    CommandLine|contains|all:
      - 'urlcache'
      - 'http'
  condition: all of selection_*
falsepositives:
  - Admin scripts that fetch certificates or CRLs with certutil
level: high

Read top to bottom, the fields fall into three groups:

  • Metadata — title, a unique id (a UUID that never changes, even when the rule is edited), status, description, references, author, date and modified. tags map the rule to MITRE ATT&CK tactics and techniques.
  • What to search — logsource names the kind of log by category (process_creation, network_connection, dns…), product (windows, linux, aws…) and optionally service (security, sysmon, cloudtrail…). It is abstract on purpose: the converter's pipeline maps it to your real index, table or data stream.
  • What to match — detection holds named selections and a condition that combines them.

The last two fields are the ones that decide how much work the rule creates downstream: falsepositives lists the legitimate activity that will also match, and level (informational, low, medium, high or critical) says how urgently a hit should be looked at.

How the detection logic works

  • Fields listed together in one map are ANDed: every one must match.
  • Values listed under one field are ORed: any one may match. A list of maps (as in selection_img above) ORs the maps.
  • condition combines selections by name with and, or, not and parentheses, or by pattern: 1 of selection_*, all of selection_*, all of them.
  • Values match case-insensitively and whole by default; * and ? work as wildcards.

Modifiers, written after a pipe, change how a value matches:

ModifierWhat it does
contains, startswith, endswithSubstring, prefix and suffix matches instead of whole-value matches.
allTurns a value list from OR into AND: every value must be present.
reMatches a regular expression. Powerful, but slower and less portable across backends.
windashAlso matches the other dash characters Windows accepts in command-line flags (-, / and Unicode dashes).
cidrMatches IP addresses inside a network range.
base64, base64offsetMatches a value as it would appear base64-encoded, as in encoded PowerShell.

Version 2 of the specification also added correlation rules (counting events, distinct values or ordered sequences across a time window) and filter rules that apply exclusions to other rules without editing them. Not every backend supports both yet; check your backend's documentation before relying on them.

Converting a rule for your SIEM

Conversion is done by pySigma, usually through sigma-cli. Each target is a backend plugin, and each backend is paired with a processing pipeline that renames Sigma's generic fields to the ones your logs actually use.

pip install sigma-cli
sigma plugin list
sigma plugin install splunk
sigma convert -t splunk -p splunk_windows rules/windows/

The older sigmac converter is deprecated; new work should use pySigma. The pipeline matters as much as the backend: if your Sysmon data is normalised to a schema such as ECS or a custom one, a rule that converts cleanly can still match nothing until the field mapping is right. Run converted queries against data where you know the behaviour occurred before trusting them in production. Which backends and pipelines exist, and how complete they are, changes often — check sigma plugin list and the pySigma plugin directory rather than a list in an article.

Keeping Sigma rules from adding to alert fatigue

A public rule set is a starting point, not a deployment. Importing a few thousand community rules into a SIEM unchanged is one of the faster ways to bury a SOC: each rule was written against someone else's environment, and its false positives are yours to find. The habits below keep the queue manageable.

  1. Deploy by status and level, not all at once. Start with stable and test rules at high and critical. Treat experimental rules as hunting queries until they have run quietly against your own data.
  2. Read `falsepositives` before enabling a rule. If the listed benign activity is routine in your estate, either write a filter for it first or don't alert on the rule at all.
  3. Put exclusions in filters, not in the rule. Environment-specific exceptions (a backup server, a deployment tool's service account) belong in a separate filter or a filter_* selection with condition: selection and not filter_*, so the upstream rule can still be updated cleanly.
  4. Backtest before you alert. Run the converted query over the last 30 days of logs and count the hits. A rule that would have fired hundreds of times on legitimate activity needs tuning before anyone is paged by it.
  5. Route by level. Send informational and low hits to a dashboard or a correlation stage rather than the analyst queue; reserve paging for rules that have earned it.
  6. Track each rule's alert volume and true-positive rate. The id makes every alert traceable to its rule. Retire or rewrite the rules that generate the most closures as benign.

Matching on command-line strings also has a ceiling: attackers can often change a flag, a path or an encoding and step around a signature while doing the same thing. Our piece on why rule-based SIEM detection fails against modern TTPs covers where that breaks down; prefer rules keyed to behaviour (parent–child process chains, OriginalFileName rather than the on-disk name) over single strings.

Validating and testing rules

  • sigma check runs pySigma's validators over a rule set and reports structural problems: missing or duplicate IDs, invalid tags, unknown modifiers and similar.
  • Keep rules in Git and run conversion and validation in CI, so a broken rule fails a pull request instead of a deployment.
  • Test against real telemetry: replay a known-bad sample or run an atomic test of the technique in a lab and confirm the converted query finds it.
  • Re-test after any log source or parser change — a renamed field silently turns a working rule into one that never fires.

Where to find rules and the specification

  • SigmaHQ/sigma — the main community rule repository, organised by log source. Its rules are published under the Detection Rule License (DRL); read its terms before reusing them in a commercial product.
  • SigmaHQ/sigma-specification — the authoritative definition of every field, modifier and condition.
  • SigmaHQ/pySigma and SigmaHQ/sigma-cli — the conversion library and its command-line tool.
  • sigmahq.io — the project's documentation site.
  • Your SIEM vendor's documentation, for which Sigma features its native importer (if it has one) supports.

Common questions

Is Sigma a SIEM? No. It is a rule format plus tooling to convert rules; the searching happens in your SIEM or log platform.

How is Sigma different from YARA or Snort rules? YARA matches patterns in files and memory (see our YARA rules guide), Snort and Suricata rules match network traffic. Sigma matches log events — process creation, authentication, cloud API calls — which is what a SIEM holds.

Do I need to write rules from scratch? Rarely at first. Most teams start from the community set, tune what fits their log sources, and write their own for the gaps their threat model shows.

Does every SIEM support every rule? No. Support depends on the backend, the pipeline and the feature: modifiers like re, and correlation rules, are not available everywhere. The converter reports what it cannot translate.

More on this in Detection Engineering and Legacy Monitoring.