Sentinel
Synopsis
Evaluates Microsoft Sentinel analytics rules against each event. The rule's KQL is compiled once, then run per event; a match annotates the event with the rule's name, severity, tactics, techniques, and resolved MITRE ATT&CK enrichment.
The rules are Sentinel analytics rules used unchanged. To convert a Sentinel ASIM parser into a pipeline instead, see From KQL; to use detection rules to reduce what reaches the SIEM, see Smart Engine.
Schema
- sentinel:
library: <string[]>
rules: <string[]>
rule_files: <string[]>
rule_dirs: <string[]>
select: <object>
mode: <enum>
mark_field: <ident>
min_severity: <enum>
mitre_enrich: <boolean>
include_query: <boolean>
table_field: <ident>
strict_table: <boolean>
enrich_on_unresolved: <boolean>
description: <text>
if: <script>
tag: <string>
disabled: <boolean>
ignore_failure: <boolean>
on_failure: <processor[]>
on_success: <processor[]>
Configuration
At least one rule source is required. With none, the processor fails.
| Field | Required | Default | Description |
|---|---|---|---|
library | Y* | Names of Sentinel rule packs assigned through the Library. | |
rules | Y* | Rules given inline, as rule YAML. | |
rule_files | Y* | Paths to rule files (.yml, .yaml). | |
rule_dirs | Y* | Directories searched recursively for rule files. | |
select | N | all rules | Narrows which of the loaded rules are registered. See below. |
mode | N | annotate | annotate marks matches and forwards every event. filter drops every event that matches no rule. |
mark_field | N | _sentinel | Root field the match markers are written under. |
min_severity | N | Ignore rules below this severity: informational, low, medium, or high. | |
mitre_enrich | N | true | Resolve MITRE ATT&CK tactics and techniques onto each match. |
include_query | N | false | Include the rule's KQL in the match. |
table_field | N | _vmetric.table | The event field holding the table name a rule is scoped against. |
strict_table | N | false | Require an event to declare a matching table before a table-scoped rule applies. See below. |
enrich_on_unresolved | N | false | Make a rule whose KQL cannot be compiled match every event it is scoped to, rather than nothing. |
description | N | Explanatory note. | |
if | N | Condition that must be true for the processor to run. | |
tag | N | Identifier for this processor instance. | |
disabled | N | false | When true, the processor is skipped. |
ignore_failure | N | false | Continue pipeline processing if the processor fails. This does not mean "keep filtering and ignore errors" — see the warning below. |
on_failure | N | See Handling Failures. | |
on_success | N | See Handling Success. |
* = At least one of library, rules, rule_files, or rule_dirs is required. Sources are combined, in that order.
ignore_failure: true silently turns this processor off. The drop is signalled to the pipeline as an error value, and the ignore_failure check runs before that value is inspected — so a matched event is kept instead of dropped, no error is logged, and the pipeline reports success. The processor appears to run normally while filtering nothing.
Use it only if you genuinely want a pass-through. To tolerate real errors without losing the filtering, leave ignore_failure unset and handle the failure with on_failure instead.
Rule Packs
Rules are supplied as packs assigned through the platform Library, one file per pack:
| Rule type | Library path |
|---|---|
| Sigma | library/sigma/<name>.yml |
| Sentinel | library/sentinel/<name>.yml |
| YARA | library/yara/<name>.yar |
A pack's name is its filename without the extension, and that name is what library refers to.
Globs are accepted, so "*" selects every assigned pack of that type and "win_*" selects those whose names begin with win_. A glob that matches nothing contributes no rules and raises no error. A name given exactly, however, must be assigned — if it is not, the processor fails with an error naming it.
The Sentinel and Smart Engine processors read the same Sentinel rule packs, so a pack assigned once can be used by both.
Select
All criteria are combined with AND; the values within one criterion are combined with OR. Matching is case-insensitive.
| Field | Description |
|---|---|
tables | Rules whose declared data types include any of these, such as SecurityEvent or CommonSecurityLog. |
connectors | Rules by required data connector id. |
severities | informational, low, medium, or high. |
kinds | Scheduled or NRT. |
tactics | MITRE tactic. Separator-insensitive, so CommandAndControl and command-and-control are equivalent. |
techniques | MITRE technique id. A parent id also selects its sub-techniques, so T1059 selects T1059.001. |
ids | Rule id, matched exactly. |
name_prefix, name_contains, name_regex | Rule title matching. |
desc_contains | Rule description matching. |
tags | Rule tags. |
A select that matches no rules is an error, raised when the first event reaches the processor.
Details
This processor runs on the Director only. An Agent skips it as if it were disabled and passes its records on unchanged; the Director logs a warning when it sends that Agent its configuration. Put it in a pipeline the Director runs, such as a route pipeline or a target postprocessing pipeline.
Annotating and Filtering
In the default annotate mode, every event is forwarded. A matching event gains its markers; a non-matching event passes through untouched.
Setting mode: filter turns the processor into an allowlist: an event that matches no rule is dropped. Use it deliberately — it discards telemetry.
Table Scoping
A rule that declares no table applies to every event. A rule scoped to a table applies to events whose table_field names that table, compared case-insensitively.
An event carrying no table at all is, by default, still evaluated against every table-scoped rule — the rule's own field predicates decide whether it fires. This favors never missing a detection, at the cost of occasional cross-table matches. Set strict_table: true to require a positive table match instead, which skips table-scoped rules for any event that does not declare a table.
This differs from Smart Engine, where an untabled event has no applicable detections at all. The two processors read the same rules but scope them differently, so do not carry an assumption from one to the other.
How a Rule's KQL Is Read
The processor reads a rule's KQL as Azure Data Explorer (ADX) reads it. A rule that compiles exactly matches the events whose rows ADX would return.
Missing Values
ADX has a rule for each comparison with a missing (null) value, and a rule's condition follows it. ADX's strings are never null: a missing string is "".
| Rule text | An event without the field X |
|---|---|
X == "" | Matches |
X != "" | Doesn't match |
X != 5, not(X == 5), X !in (1, 2) | Matches |
X == 5, X in (1, 2) | Doesn't match |
X in (1, long(null)) | Doesn't match: ADX gives null |
not(X < 5), X !between (1 .. 5), not(ipv4_is_private(X)) | Doesn't match: ADX gives null, and not() of null is still null |
X == Y, both strings, both missing | Matches: both are "" |
X == Y, both of another type, both missing | Doesn't match: ADX gives null |
X > 0 or Y > 0 | Matches when Y > 0 does |
- A field's type comes from the table schemas the product ships, from the ASIM table that an ASIM parser function returns, or from a
datatablein the query. A literal on the other side of a comparison, such as""or5, gives the type too. - Two fields of unknown types. For
X == YorX != Y, the answer for an event without one of them depends on the type: a missing string is"", and a missing number is null. Such a rule can't be compiled exactly (see Rules That Cannot Be Compiled). Give one side a type, as intostring(X) == Y, and the rule compiles exactly. True,TRUEandFalseare bool literals, astrueandfalseare.
Text
The operators that ignore case compare letters as ADX does, in every script: contains, startswith, endswith, =~, !~, in~ and !in~. contains_cs, startswith_cs and endswith_cs match case.
The term operators read terms as ADX does: has, !has, has_any, has_all, hasprefix, hassuffix, and their _cs forms. A term is a run of letters and digits of any script. Every other character separates terms, an underscore among them.
| Rule text | Result |
|---|---|
"ÖZTÜRK" contains "öz" | true |
"IŞIK" =~ "ışık" | false: the lower case of I is i, not ı |
"İSTANBUL" =~ "istanbul" | false: ADX keeps İ as it is |
"ΣΟΦΙΑ" =~ "σοφια" | true |
"a_log" has "log", "x_öztürk" has "öztürk" | true |
"blog" has "log" | false: has matches whole terms |
"a_log" hasprefix "lo" | true: hasprefix reads the start of any term, not of the whole text |
In matches regex, the classes \w, \W, \d, \D, \s and \S are Unicode classes, as in ADX. \w matches a letter or digit of any script, such as é, 日本語 or Arabic-Indic digits, and connector punctuation such as _. \s matches a no-break space and the other Unicode spaces. \b stays an ASCII word boundary, because ADX's is one.
Numbers and Timespans
toint(), tolong() and todouble() read a field as ADX does. Blanks around a number are ignored, and toint() and tolong() read hex text such as "0x10" as 16. Text that isn't a number is null. toint() keeps the low 32 bits of a whole number, so toint() of 2147483648 is -2147483648. int(), long() and real() of a literal give the same answers.
A timespan can use its unit's long name, as in ADX, in lower case only:
| Unit | Names |
|---|---|
| Days | d, day, days |
| Hours | h, hr, hrs, hour, hours |
| Minutes | m, min, minute, minutes |
| Seconds | s, sec, second, seconds |
| Milliseconds | ms, milli, millis, millisec, millisecond, milliseconds |
| Microseconds | micro, micros, microsec, microsecond, microseconds |
| Nanoseconds | nano, nanos, nanosec, nanosecond, nanoseconds |
| Ticks | tick, ticks |
So ago(10min), ago(4hrs) and Duration > 250millis compile as ago(10m), ago(4h) and Duration > 250ms do.
Other KQL That Rules Can Use
- A query in parentheses at the start.
(SigninLogs | where ResultType == "50126") | summarize count() by UserPrincipalNamekeeps the filter inside the parentheses. A rule that begins with aunionin parentheses can't be compiled exactly, as aunionwithout them can't. - Names that begin with digits, for a column, a summarize key, a table or a
let:extend 5Minutebin = bin(TimeGenerated, 5m). A number or a timespan keeps its meaning (5m,1e5,5L). As in ADX, a number written right before a keyword reads as a name, so writea > 0 and a < 2, nota>0and a<2. mvexpandandmvapply, the old spellings ofmv-expandandmv-apply.bin(T = TimeGenerated, 1h), which names its column inside the call.- Hex numbers.
0x10is 16, and0xFFFFFFFFFFFFFFFFis -1. - More
datatableforms: a trailing comma after the columns, as indatatable(a:long, b:string,)[...], rows that each begin with a comma, a table of one single-quoted value such asdatatable(s:string)['x'], anddatatable() [], a table with no columns and no rows. - An operator's hint, such as
summarize hint.strategy = shuffle, which changes no row.
After the upgrade, a rule can match other events than before. The new answers are ADX's. The changes are on
- events without a field that the rule tests. For example,
X != ""used to match every event withoutX, which raised alerts that Sentinel never raises. - text with letters outside ASCII or with underscores.
- rules that use a long timespan unit, which earlier releases couldn't compile, so they matched no event by default.
- rules that begin with a query in parentheses. Earlier releases dropped the filter inside the parentheses, so the rule matched every event of its table.
Rules That Cannot Be Compiled
Some Sentinel rules use KQL that has no per-event form. Such a rule is marked unmatchable and enriches nothing — it fails closed. Setting enrich_on_unresolved: true reverses that: the rule instead matches every event whose table it positively declares, which annotates far more events but never misses one.
The processor logs a Warning for each such rule, which says what happens to it:
sentinel: rule "Example Rule" can't be compiled exactly, so it never matches (set enrich_on_unresolved to have it match every event of its tables)
Rules With a Syntax Error
A rule whose KQL query has a syntax error is broken. The processor never matches a broken rule, whatever enrich_on_unresolved says. That setting is for rules that are too complex to compile exactly, not for rules that can't be read. Sentinel does the same: a rule that ADX can't read doesn't run.
Each time the rules load, the processor logs one Error for each broken rule. The Error names the rule and says where the syntax error is:
sentinel: rule "Broken Rule" is broken and never matches: its query has a syntax error at line 2, column 26: mismatched input 'and' expecting <EOF>
The processor's health line counts broken rules apart from the rules it can't compile exactly:
sentinel rule health: 120 rules loaded from 1 source(s), 2 broken by a syntax error, which never match, 9 that can't be compiled exactly, which never match (fail closed)
With enrich_on_unresolved: true, the end of that line reads which match every event of their tables (enrich_on_unresolved).
In earlier releases, a rule with a syntax error was handled like a rule that can't be compiled exactly. Nothing said which rule was broken, and with enrich_on_unresolved: true the rule matched every event of its table.
The processor reads these forms of ADX's KQL, so a rule that uses one is not broken:
- An accessor on a value in parentheses:
(parse_json(s)).a,(split(s, "/"))[1]. - A bracket after a dot:
d.["key"],d.[0]. project-reorderwith a bare*, which stands for the columns the list doesn't name.project-reorder *, AputsAlast.- Tuple names for
arg_max()andarg_min():summarize (Time, User) = arg_max(TimeGenerated, User) by Id. - h-strings, such as
h"secret"andh@'C:\x'. Their value is the string's. - A hex count, as in
take 0x10ortop 0x10 by x. - Join conditions written with
and:on $left.a == $right.b and $left.c == $right.d. - A join of a bare table, as in
join AlertEvidence on AlertId, andkind=anti. filter, the other spelling ofwhere.mv-expand ... limit 10.
Markers
| Field | Description |
|---|---|
_sentinel.matched | true on a matching event. |
_sentinel.rules | One entry per matched rule. |
_sentinel.count | The number of matched rules. |
Each entry in _sentinel.rules carries name, and — when the rule defines them — id, severity (lower-cased), tactics, techniques, tables, fields, and mitre. The rule's query is included only under include_query.
Examples
Annotating a Match
Registering an assigned rule pack, narrowed to the rules for one table... | |
A matching event is annotated with the rule and its ATT&CK enrichment. The event itself is unchanged... | |
Filtering to Rule Matches Only
Forwarding only events that some high-severity rule matched... | |
An event matching no high-severity rule is dropped. Nothing is forwarded for it... | |
Requiring a Declared Table
Scoping strictly, so a rule fires only for events that positively declare its table... | |
An event without | |