Conditions
A condition step splits a workflow into paths. It compares a field on the event to a value and sends the event down the first branch that matches. If no branch matches, the event leaves through the no_match edge.
BranchesDirect link to Branches
A condition holds an ordered list of branches. Each branch has:
| Part | Meaning |
|---|---|
| Handle | The branch's identifier. An edge uses it to leave the condition |
| Label | A readable name for the path |
| Field | The event field to read, such as severity, eventType, sourceKind, or providerId |
| Operator | How to compare the field with the value |
| Value | A string, number, boolean, or list of strings |
A condition needs at least one branch. Guard checks branches in order and takes the first match, so put the most specific branch first.
The field is a top-level name on the event. The fields that Guard Cloud sets are listed under Enrichment. In the studio's inspector, the field menu offers severity, eventType, sourceKind, and providerId, and the inspector edits the first branch. Additional branches in an imported or saved workflow are kept.
OperatorsDirect link to Operators
| Operator | Matches when |
|---|---|
eq | The field equals the value |
neq | The field does not equal the value |
gt, gte, lt, lte | The field and the value are both numbers and the comparison holds |
contains | The field is a string that contains the value, or a list that includes the value |
in | The value is a list and the field equals one of its items |
Comparison operators that use order only work on numbers, such as riskScore. A text field such as severity compares with eq, neq, or in. For example, to match both high and critical, use severity in ["high", "critical"].
If the field is missing from the event, eq, the numeric operators, contains, and in do not match, and neq does match. A field of a different type than the value does not match eq or the numeric operators.
Connect the branchesDirect link to Connect the branches
Each branch needs an edge out of the condition:
- A
matchedge leaves through a branch handle. When the condition declares handles, everymatchedge must name one of them. The studio rejects amatchedge with no handle or an unknown handle. - A
no_matchedge is the path when no branch matches. It can only start at a condition. - A condition cannot have two edges with the same type and handle.
Always connect the no_match path. Send it to a terminal with the outcome no_op or suppressed so the run records why nothing was delivered.
In a test run, branches that were not taken appear as skipped with the message that the branch was not taken. See Test runs and live delivery for how conditions relate to live delivery.
ExampleDirect link to Example
Send critical events to PagerDuty, other high-severity events to Slack, and record everything else:
- A condition with a branch
criticalwhereseverityeqcritical, and a branchhighwhereseverityeqhigh. - A
matchedge fromcriticalto a PagerDuty action, and amatchedge fromhighto a Slack action. - A
no_matchedge to a terminal with the outcomeno_op. - A
failureedge from each action to a terminal with the outcomefailure.