Sigma Rule Validator Guide: Check a Detection Rule Before It Goes Live
A detection rule that is wrong in a subtle way is worse than no rule at all, because it creates confidence without coverage. A team believes a technique is monitored, the rule sits in the system, and nothing alerts, not because the technique never occurs but because the rule never matches it. A Sigma rule validator exists to catch that class of failure before deployment: it checks a rule's structure, its fields, and its logic, and reports the errors that would otherwise surface only as silence. The Sigma Rule Validator performs that check on rule text you supply, turning a hopeful deployment into a verified one.
Sigma rules have a structure that looks simple and hides many small ways to go wrong. A rule carries metadata, such as a title, a description, and an identifier. It names a log source, saying which kind of events it applies to. It defines a detection section, with named selections of field-and-value patterns and a condition that combines them. It can carry a level indicating severity, and tags linking it to known technique frameworks. Each of these parts has rules of its own, and an error in any part can break the rule or change its meaning: a misspelled field name means the rule matches nothing, a condition referencing a selection that does not exist means the rule cannot run, and a log source that does not match the platform's data means the rule watches the wrong events entirely.
Validation is also the gate that keeps a shared rule collection healthy. Teams adopt rules from community sources, adapt rules written by colleagues, and write rules under time pressure during incidents. Each of those paths introduces errors at a different rate, and a validator applied uniformly, to every rule regardless of origin, is what keeps the collection trustworthy. A rule that passes validation is not guaranteed to be a good detection, since validation checks form and logic rather than judgement, but a rule that fails validation is guaranteed to be a broken one, and that distinction alone justifies the check.
How a Sigma rule is validated
Validation proceeds in layers. The first layer checks that the rule is well-formed: that its structure parses, that required sections are present, and that values are of the expected kind. A rule missing its detection section, or with a condition written as plain text where a structured expression is required, fails here, and the validator reports the position of the problem.
The second layer checks internal consistency. Every selection referenced in the condition must exist in the detection section, and every selection defined should be used by the condition, since an unused selection is usually a leftover from an edit that changed the rule's meaning. Field names are checked against the known fields for the declared log source, so a field that does not exist for that source is flagged rather than silently matching nothing. Value modifiers, such as those that request a contains match or a case-insensitive match, are checked for correct spelling and placement, because a misspelled modifier is ignored by some systems rather than reported, which changes matching behaviour without any error.
The third layer checks the rule's metadata and conventions: that the identifier is unique and well-formed, that the level is one of the accepted values, that tags reference real technique identifiers, and that the title and description are present and meaningful. These checks do not affect whether the rule runs, but they affect whether the rule can be managed, shared, and understood later. A rule with a duplicated identifier can overwrite another rule in a collection, and a rule with a meaningless description cannot be triaged when it fires.
As with conversion, the validator works on rule text you supply, without connecting to your log platform and without needing credentials. Rule text can contain internal details, such as hostnames or user names used as example values, so redact or generalize those before pasting into any tool, and treat the validated output with the same care as the input. Validation proves structure and logic; it does not prove the rule will fire on real attacker behaviour, which is a question for testing against historical logs.
Worked example
Consider a security analyst who writes a rule to detect a suspicious pattern: a scripting tool launched with an encoded command, a technique often used to hide malicious instructions. The rule's detection section defines two selections: one for the scripting tool's process name, and one for the encoded command flag in the command line. The condition requires both selections. The analyst runs the validator and receives three findings. First, the field name used for the command line is misspelled, so the second selection would match nothing. Second, the condition references a third selection that was deleted during editing, so the rule cannot run at all. Third, the rule's level is written as high, while the accepted values use a different term, so the severity would be unrecognized.
The analyst fixes all three: the field name is corrected, the condition is rewritten to reference only the two existing selections, and the level is set to an accepted value. Re-running the validator shows a clean result. The analyst then tests the corrected rule against historical logs and confirms it matches the known test events, including a red-team exercise from the previous month that used the encoded command technique. Had the rule been deployed without validation, it would have matched nothing, and the team would have believed the technique was monitored while it was not. The validator's ten-minute check prevented a coverage gap that might have lasted months.
The example shows the typical pattern of rule errors: a spelling mistake, a leftover reference from an edit, and a metadata value outside the accepted set. None of these is a judgement error about what to detect; all three are mechanical errors that a validator catches reliably. That is why validation belongs in the deployment routine for every rule, not just for rules written by newcomers.
Mistakes to avoid
The first mistake is deploying a rule without validating it, on the assumption that a rule that looks right will run right. The second is fixing only the first error a validator reports and not re-running it, when errors hide behind each other. The third is ignoring unused selections, which are usually leftovers that reveal the rule's logic changed mid-edit. The fourth is pasting rule text containing internal hostnames or user names into a tool without redacting them. The fifth is treating a passing validation as proof the rule detects real attacker behaviour, when that proof comes only from testing against historical logs. The sixth is validating a rule once and never again, even though later edits can reintroduce errors.
Putting it into practice
Validate every rule before deployment, regardless of who wrote it or where it came from, and re-validate after every edit. Fix errors one at a time and re-run the validator after each fix. After validation passes, test the rule against historical logs to confirm it matches the events it was written for. Keep validated rules in a collection with unique identifiers and meaningful descriptions, so the collection stays manageable as it grows.
For related tools, the Sigma Rule Converter translates a validated rule into a platform's query language, the Regex Tester checks the patterns used inside rule values, and the companion guide on comparing two documents covers careful side-by-side reading. Validation is the gate between writing a rule and trusting it, and it is a gate every rule should pass through.
Key points
- A Sigma rule's structure, field names, condition references, and metadata can all contain errors that make the rule silently match nothing
- A validator checks well-formedness, internal consistency, field validity, and metadata conventions, layer by layer
- Fix errors one at a time and re-run the validator, because errors hide behind each other
- Redact internal hostnames and user names from rule text before pasting it into any tool
- Validation proves a rule is well-formed and logical; testing against historical logs proves it detects real behaviour
In short: validate every rule before deployment, test it against history after validation, and never let an unvalidated rule create false confidence in your coverage.