Join our Newsletter — 33% off our NHI Course
Home› Guides› Sigma Rule Syntax Cheat Sheet: Fields, Modifiers and…
Template SOC & Detection Engineering

Sigma Rule Syntax Cheat Sheet: Fields, Modifiers and Conditions

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, under the editorial direction of Lalit Choda Updated 27 November 2026 12 min read
On this page

Most broken Sigma rules fail on syntax details, such as a modifier the backend does not support, a list where a map was needed, or a condition that binds differently than the author expected. This cheat sheet is a compact lookup for detection engineers writing or reviewing Sigma rules: the rule fields and which are mandatory, logsource values, value modifiers, condition operators and precedence, correlation rules, and the commands for checking and converting rules. It follows the SigmaHQ Sigma Rules Specification version 2.1.0 (release date 2 August 2025), checked in November 2026; confirm against the specification repository before relying on newer features. For what Sigma is, how the SigmaHQ rule repository is organised and how to deploy it, see the Sigma Rules Guide.

Key takeaways

  • Only three things are mandatory. A rule needs title, logsource and detection (with a condition); everything else is optional but expected in shared rules.
  • Maps are AND, lists are OR. Keys in one selection are ANDed; values in a list are ORed unless you add the |all modifier.
  • Matching is case-insensitive by default. Use |cased for case-sensitive strings; regular expressions with |re are case-sensitive unless you add |re|i.
  • Precedence is or, and, not, x of, brackets (least to most binding). Use brackets whenever a condition mixes and and or.
  • Type modifiers depend on the backend. re, cidr and similar modifiers must be supported by the target, so convert and test every rule against each backend you deploy to.

How to use this template

  • Writing a rule: start from the skeleton in section 1, fill the fields in the order shown in section 2, then build selections with the modifier table in section 4.
  • Reviewing a rule: check the mandatory fields, the logsource triple, each modifier against the table, and the condition against the precedence list in section 5.
  • Converting a rule: use section 6 for sigma-cli commands, backends and processing pipelines.
  • Version note: modifier and field availability is taken from specification v2.1.0. Version 2.1.0 added neq and the time modifiers; older tooling may not accept them.

Detection engineering practice beyond syntax (prioritisation, testing strategy, lifecycle) is covered in the Detection Engineering Guide and the Detection as Code Guide.

1. Rule structure at a glance

A Sigma rule is a YAML document. The specification asks for UTF-8, LF line endings, 4-space indentation, lowercase keys, single-quoted strings and unquoted numbers. File names should be 10 to 70 lowercase characters using letters, digits and underscores, with a .yml extension.

1 Sample only, based on the public documentation cited. Assess it independently against the current official documentation, test outside production and back up first.

Sample 1
title: Whoami Execution
id: 00000000-0000-4000-8000-000000000000   # random UUID v4
status: test
description: Detects execution of whoami.exe
references:
    - https://example.org/source
author: Your Name
date: 2026-11-26
tags:
    - attack.discovery
    - attack.t1033
logsource:
    category: process_creation
    product: windows
detection:
    selection:
        Image|endswith: '\whoami.exe'
    condition: selection
falsepositives:
    - Administrative scripts
level: medium

The spec places top-level keys in this order: title, id, name, related, taxonomy, status, description, license, references, author, date, modified, logsource, detection, fields, falsepositives, level, tags, scope, then any custom fields.

2. Required and optional fields

FieldUseFormat and allowed values
titleMandatoryWhat the rule detects, max 256 characters
idOptionalGlobally unique, random UUID version 4. Issue a new id for major logic changes, derived rules kept active alongside the original, or merges
nameOptionalUnique human-readable name, usable instead of the id in correlation rules
relatedOptionalList of id plus type: derived, obsolete, merged, renamed, similar
taxonomyOptionalField and logsource naming scheme; default is sigma
statusOptionalstable, test, experimental, deprecated, unsupported
descriptionOptionalThe activity detected, max 65,535 characters
licenseOptionalSPDX licence identifier
authorOptionalComma-separated if more than one
referencesOptionalList of sources the rule was derived from
date, modifiedOptionalISO 8601 YYYY-MM-DD. Update modified when title, detection, level or logsource changes, or status becomes deprecated
logsourceMandatorycategory, product, service, definition (see section 3)
detectionMandatorySearch identifiers plus condition (sections 4 and 5)
fieldsOptionalLog fields to show the analyst
falsepositivesOptionalList of known benign triggers
levelOptionalinformational, low, medium, high, critical
tagsOptionalLowercase, namespaced with dots, e.g. attack.t1059.001
scopeOptionalIntended scope, e.g. server

Level guidance from the spec: informational is for enrichment and should not raise cases; low and medium are informative and reviewed regularly; high should raise an internal alert for prompt review; critical indicates an incident and is used only when probability borders on certainty.

Status guidance: stable may be used in production; test is mostly stable but may need tuning; experimental may be noisy; deprecated is replaced by another rule linked in related; unsupported cannot be used as written.

3. Logsource

The logsource tells converters which data the rule applies to. Values are lowercase, spaces become underscores, and dots and hyphens are allowed. The three evaluated attributes can be used alone or together; definition is free text for readers and is not evaluated.

AttributeSelectsExamples
categoryA logical group of logs across productsprocess_creation, firewall, webserver, antivirus
productAll logs from one product or operating systemwindows, linux, apache
serviceA specific subset of a product's logssecurity, system, sshd, applocker, firewall-as
definitionExplanation of required logging configuration"Requires Sysmon Event ID 1" or an audit policy note

Prefer generic categories such as category: process_creation with product: windows over one rule per telemetry source; processing pipelines then map the category to Sysmon, Windows Security auditing or EDR data. Field names follow the Sigma taxonomy (for example Image, CommandLine, ParentImage). For fields without a mapping, use the name as it appears in the log with spaces removed; for Windows XML, join tag and attribute with an underscore (Provider_Name) and use the Data Name attribute for EventData fields. Telemetry choices are covered in the EDR Telemetry Guide.

4. Detection and value modifiers

Search identifiers, lists and maps

ConstructLogicExample
Map (key: value pairs)All pairs ANDedEventID: 4769 and TicketEncryption: '0x17' in one selection
List of values under one keyValues ORedEventID: [517, 1102]
List of mapsMaps ORed- Image|endswith: ... / - Description|contains: ...
List of strings (keywords)Strings ORed, searched across the whole eventkeywords: ['event::clear', 'event::drop']
Keywords with '|all':Strings ANDedAll listed keywords must appear
  • Wildcards: * matches any length, ? one character. Prefer modifiers over leading and trailing wildcards.
  • Escaping: backslash escapes *, ? and itself. A plain backslash not followed by a wildcard can be single. \* is a literal asterisk; \\* is a backslash followed by a wildcard; \\\* is a literal backslash and asterisk.
  • Empty and null: empty is '', null is null. null cannot sit in a list with other values; to express "not null", put the null test in its own selection and negate it in the condition.
  • Placeholders: values like %Servers% are treated as placeholders only with the |expand modifier (since Sigma 1.1). Standard names include %Administrators%, %JumpServers%, %Workstations%, %Servers% and %DomainControllers%. Tools that cannot resolve placeholders must reject the rule.

Value modifier reference

Modifiers follow the field name after a pipe and can be chained (field|mod1|mod2: value); they apply in the order written. The specification distinguishes transformation modifiers (generally backend-agnostic) from type modifiers, which the backend must support.

ModifierGroupEffect
containsGenericWildcards around the value: match anywhere
startswithGenericValue at the start of the field
endswithGenericValue at the end of the field, e.g. Image|endswith: '\cmd.exe'
allGenericList values ANDed instead of ORed. Not allowed on a single value
existsGenerictrue or false: field present or absent (presence only, not value)
casedGenericCase-sensitive match (default is case-insensitive)
neqGeneric and numericField differs from the value (added in v2.1.0)
windashStringGenerates permutations of hyphen, slash, en dash, em dash and horizontal bar for Windows command-line flags
reString (type)PCRE subset: ., ^ $, * + ? {n,m}, character classes, |, groups. Other metacharacters are unsupported. Case-sensitive by default
re|i, re|m, re|sRegex sub-modifiersCase-insensitive; multi-line anchors; dot matches newline
base64EncodingValue Base64 encoded
base64offsetEncodingThree variants covering 0 to 2 byte shifts, for values inside a larger encoded string
utf16le (alias wide), utf16be, utf16EncodingUTF-16 encodings; utf16 adds a byte order mark. Chain before base64 for encoded PowerShell
lt, lte, gt, gteNumericNumeric comparisons
minute, hour, day, week, month, yearTime (v2.1.0)Extract a number from a date value; no timezone or format conversion
cidrIP (type)IPv4 or IPv6 range, e.g. DestinationIp|cidr: 10.0.0.0/8
expandSpecificResolve placeholders through the processing pipeline
fieldrefSpecificCompare with another field of the same event; combinable with neq
Sample 1
detection:
    selection_img:
        Image|endswith: '\powershell.exe'
    selection_cli:
        CommandLine|windash|contains:
            - ' -enc '
            - ' -encodedcommand '
    filter_main_admin:
        User|expand: '%Administrators%'
    condition: all of selection_* and not 1 of filter_main_*

5. Conditions and correlation

ExpressionMeaning
sel1 and sel2, sel1 or sel2Logical AND, OR
not filterNegation
( ... )Grouping
1 of selection*Any search identifier matching the pattern
all of selection*Every search identifier matching the pattern
1 of them / all of themAcross all identifiers not starting with _. The spec discourages all of them because it blocks generic filtering downstream
Condition as a listEach item generates a query; items are ORed

Precedence, least to most binding: or, and, not, x of, brackets. So a or b and not c means a or (b and (not c)). Name selections selection_* and filters filter_* so pattern conditions stay readable and tuning can target filters.

Correlation rules

Correlations are separate YAML documents with a correlation section that refers to other rules by id or name.

KeyUseValues
typeMandatoryevent_count, value_count, temporal, temporal_ordered
rulesMandatoryIds or names of Sigma or correlation rules (chaining allowed)
group-byOptionalFields defining the scope, ANDed when several (e.g. same host and user)
timespanMandatoryNumber plus lowercase unit: s, m, h, d (e.g. 90m)
conditionMandatoryExactly one of gt, gte, lt, lte, eq, neq; for value_count add field
aliasesOptionalMap different field names across rules to one name for group-by
generateOptionalAlso convert referenced rules as stand-alone queries (default: correlation query only)
Sample 1
title: Many failed logons from one source
correlation:
    type: event_count
    rules:
        - failed_logon
    group-by:
        - IpAddress
    timespan: 10m
    condition:
        gte: 20

For shared exclusions across many rules, the Sigma Filters specification defines global filter documents (file prefix mf_ as best practice) that apply one tuning to several rules, so the base rules stay unmodified.

6. Testing and conversion

TaskCommand or componentNotes
Install the CLIpython -m pipx install sigma-cliOr pip install sigma-cli
Find backends and pipelinessigma plugin list, sigma list targets, sigma list pipelinesInstall with sigma plugin install <id>
Validate rulessigma check <path>Run in CI on every change
Convertsigma convert -t <backend> -p <pipeline> <path>e.g. -t splunk -p sysmon; several -p allowed
Output formatssigma list formats <backend>, then -fe.g. Splunk saved searches
Schema validationJSON schemas in the specification repositoryRules, correlations and filters each have a schema
  1. Lint and check: run sigma check and schema validation in the pull request pipeline.
  2. Convert per target: convert with the exact backend and pipelines used in production; a conversion error usually means an unsupported type modifier or a missing field mapping.
  3. Replay data: test against recorded true-positive events and a sample of normal traffic before enabling alerting.
  4. Stage the rollout: deploy as experimental or test, monitor volume, then promote to stable.
  5. Roll back: disable the converted query and set status: deprecated with a related link if a replacement exists.
FrameworkReferenceHow Sigma rules relate
NIST CSF 2.0DE.CM-01, DE.AE-02Monitoring for and analysing potentially adverse events
NIST SP 800-53 Rev 5SI-4, AU-6System monitoring; audit record review and analysis
MITRE ATT&CKattack.* tags, e.g. T1059.001 PowerShellCoverage mapping from rule tags

Useful measures: share of rules converting without error per backend, share of rules with replay tests, false positive rate per rule level, and rules still at experimental after a set review period. See the Detection Engineering Metrics and KPIs Guide. How Sigma compares with file and network rule languages is in Sigma vs YARA vs Snort Rules.

Common syntax mistakes

  • Duplicate keys in one map: depending on the parser this is rejected or one value silently overwrites the other; use a list or separate selections.
  • null inside a value list: invalid; give it its own selection.
  • Unbracketed mixed conditions: a or b and c silently means a or (b and c).
  • Placeholder without |expand: %Servers% is matched literally.
  • Unsupported regex features: lookarounds and other metacharacters outside the spec's PCRE subset fail or behave differently per backend.

Practitioner checklist

  • Include title, logsource and detection with condition, plus a UUID v4 id.
  • Set status, level, falsepositives and ATT&CK tags on every shared rule.
  • Use generic logsource categories and Sigma taxonomy field names.
  • Prefer contains, startswith and endswith to manual wildcards.
  • Check every type modifier (re, cidr, time modifiers) is supported by each target backend.
  • Bracket any condition that mixes and and or.
  • Name selections and filters consistently so 1 of and all of patterns work.
  • Run sigma check and conversion for each backend in CI.
  • Replay true-positive and benign data before promoting a rule to stable.

Standards and references

Related NHI Mgmt Group resources: Sigma Rules Guide · Detection Engineering Guide · Detection as Code Guide · Sigma vs YARA vs Snort Rules

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick both boxes to continue.