Skip to main content

Sentinel

Security Threat Intelligence Flow Control

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.

FieldRequiredDefaultDescription
libraryY*Names of Sentinel rule packs assigned through the Library.
rulesY*Rules given inline, as rule YAML.
rule_filesY*Paths to rule files (.yml, .yaml).
rule_dirsY*Directories searched recursively for rule files.
selectNall rulesNarrows which of the loaded rules are registered. See below.
modeNannotateannotate marks matches and forwards every event. filter drops every event that matches no rule.
mark_fieldN_sentinelRoot field the match markers are written under.
min_severityNIgnore rules below this severity: informational, low, medium, or high.
mitre_enrichNtrueResolve MITRE ATT&CK tactics and techniques onto each match.
include_queryNfalseInclude the rule's KQL in the match.
table_fieldN_vmetric.tableThe event field holding the table name a rule is scoped against.
strict_tableNfalseRequire an event to declare a matching table before a table-scoped rule applies. See below.
enrich_on_unresolvedNfalseMake a rule whose KQL cannot be compiled match every event it is scoped to, rather than nothing.
descriptionNExplanatory note.
ifNCondition that must be true for the processor to run.
tagNIdentifier for this processor instance.
disabledNfalseWhen true, the processor is skipped.
ignore_failureNfalseContinue pipeline processing if the processor fails. This does not mean "keep filtering and ignore errors" — see the warning below.
on_failureNSee Handling Failures.
on_successNSee Handling Success.

* = At least one of library, rules, rule_files, or rule_dirs is required. Sources are combined, in that order.

warning

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 typeLibrary path
Sigmalibrary/sigma/<name>.yml
Sentinellibrary/sentinel/<name>.yml
YARAlibrary/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.

FieldDescription
tablesRules whose declared data types include any of these, such as SecurityEvent or CommonSecurityLog.
connectorsRules by required data connector id.
severitiesinformational, low, medium, or high.
kindsScheduled or NRT.
tacticsMITRE tactic. Separator-insensitive, so CommandAndControl and command-and-control are equivalent.
techniquesMITRE technique id. A parent id also selects its sub-techniques, so T1059 selects T1059.001.
idsRule id, matched exactly.
name_prefix, name_contains, name_regexRule title matching.
desc_containsRule description matching.
tagsRule tags.

A select that matches no rules is an error, raised when the first event reaches the processor.

Details​

warning

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 textAn 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 missingMatches: both are ""
X == Y, both of another type, both missingDoesn't match: ADX gives null
X > 0 or Y > 0Matches 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 datatable in the query. A literal on the other side of a comparison, such as "" or 5, gives the type too.
  • Two fields of unknown types. For X == Y or X != 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 in tostring(X) == Y, and the rule compiles exactly.
  • True, TRUE and False are bool literals, as true and false are.

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 textResult
"Ö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:

UnitNames
Daysd, day, days
Hoursh, hr, hrs, hour, hours
Minutesm, min, minute, minutes
Secondss, sec, second, seconds
Millisecondsms, milli, millis, millisec, millisecond, milliseconds
Microsecondsmicro, micros, microsec, microsecond, microseconds
Nanosecondsnano, nanos, nanosec, nanosecond, nanoseconds
Tickstick, 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 UserPrincipalName keeps the filter inside the parentheses. A rule that begins with a union in parentheses can't be compiled exactly, as a union without 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 write a > 0 and a < 2, not a>0and a<2.
  • mvexpand and mvapply, the old spellings of mv-expand and mv-apply.
  • bin(T = TimeGenerated, 1h), which names its column inside the call.
  • Hex numbers. 0x10 is 16, and 0xFFFFFFFFFFFFFFFF is -1.
  • More datatable forms: a trailing comma after the columns, as in datatable(a:long, b:string,)[...], rows that each begin with a comma, a table of one single-quoted value such as datatable(s:string)['x'], and datatable() [], a table with no columns and no rows.
  • An operator's hint, such as summarize hint.strategy = shuffle, which changes no row.
note

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 without X, 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).

note

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-reorder with a bare *, which stands for the columns the list doesn't name. project-reorder *, A puts A last.
  • Tuple names for arg_max() and arg_min(): summarize (Time, User) = arg_max(TimeGenerated, User) by Id.
  • h-strings, such as h"secret" and h@'C:\x'. Their value is the string's.
  • A hex count, as in take 0x10 or top 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, and kind=anti.
  • filter, the other spelling of where.
  • mv-expand ... limit 10.

Markers​

FieldDescription
_sentinel.matchedtrue on a matching event.
_sentinel.rulesOne entry per matched rule.
_sentinel.countThe 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...

- sentinel:
library:
- "*"
select:
tables:
- SecurityEvent

A matching event is annotated with the rule and its ATT&CK enrichment. The event itself is unchanged...

{
"_sentinel": {
"matched": true,
"count": 1,
"rules": [
{
"name": "Suspicious process executed",
"severity": "high",
"tactics": ["Execution"],
"techniques": ["T1059"]
}
]
}
}

Filtering to Rule Matches Only​

Forwarding only events that some high-severity rule matched...

- sentinel:
library:
- "*"
mode: filter
min_severity: high

An event matching no high-severity rule is dropped. Nothing is forwarded for it...

// dropped

Requiring a Declared Table​

Scoping strictly, so a rule fires only for events that positively declare its table...

- sentinel:
library:
- windows_rules
strict_table: true

An event without _vmetric.table is skipped by every table-scoped rule rather than evaluated against it. Without strict_table, the same event would have been evaluated...

{
"EventID": 4688,
"Process": "powershell.exe"
}