Write advanced conditions for filtering alerts using ASQ
Advanced conditions let you decide when a rule or policy applies by writing a query, instead of picking conditions from dropdowns. Unlike in basic, in the advanced editor, you can combine AND, OR, and NOT, and group conditions with parentheses to define complex conditions. That means one rule can handle logic that would otherwise need several.
Advanced conditions use the same syntax as alert search, with a few differences. This page lists the fields, operators, and limits you can use, and explains how a condition differs from a search.
Where you can use advanced conditions
Alert policies, notification policies, alert group notification policies, routing rules, user notification preferences and rules, and role-based notification rules.
Switch to the advanced editor
Open the rule or policy you want to edit, or create a new one.
In the alert filters section, switch from Basic to Advanced.
Enter your query. When you select outside the field, we validate the query and show any errors.
[保存] を選択します。
Rules you've already built in the basic editor keep working as they are.
フィールド参照
Use field:value with the fields below. Field names are case-sensitive: write message, not Message.
条件 | 説明 |
|---|---|
| The alert message. |
| The alert description. |
| The alert alias. |
| The alert entity. |
| The alert source. |
| P1 to P5. The only field that works with |
| One of the alert's tags. |
| One of the alert's actions. |
| A team or user on the alert, by full name. |
| The alert has a detail with this key. |
| One of the alert's details has this value. |
| The detail |
Fields that only exist later in an alert's life, such as count, status or createdAt, can't be used. A condition runs when you create the alert, before those values exist.
On AI notification policies
An AI notification policy matches a group of alerts, not one alert. A group has four fields, and only these can be used:
条件 | 説明 |
|---|---|
| The group's title, generated when the group is formed. It is not any single alert's message. |
| The group's priority. |
| The group's tags. |
| The group's classification: |
条件演算子
例 | 説明 |
|---|---|
| Equals. |
| Does not equal. |
| More urgent than P3, so P1 or P2. |
| Less urgent than P3, so P4 or P5. |
> and < work on priority only. >= and <= are not supported; the error tells you what to write instead. For example, priority >= P3 becomes priority > P4.
Quoting values
Quote a value when it contains a space or any of : ( ) < > = ! \, or when it starts with an asterisk. Single and double quotes both work.
例 | 説明 |
|---|---|
| A value with a space. |
| One kind of quote inside the other needs nothing extra. To use the same kind, put a backslash before it. |
Also quote a value that is a keyword: true, false, and, or, not or is. For example, message:"true".
A value cannot be empty: source:"" is rejected.
論理演算子
Group values for one field with parentheses:
例 | 説明 |
|---|---|
| The alert has the prod tag or the canary tag. |
| The alert has both tags. |
Combine conditions with AND, OR and NOT:
例 | 説明 |
|---|---|
| Both match. |
| Mixing AND and OR. The parentheses are required. |
| The source is not web01, including alerts with no source. |
Mixing AND and OR needs parentheses.
priority:P1 AND tags:prod OR source:web01is rejected, because it can be misread. Add parentheses to say which you mean. The same applies inside a field group.Join every pair of conditions.
source:web01 tags:prodis rejected. Writesource:web01 AND tags:prod.Write AND, OR and NOT in upper or lower case.
andworks;Anddoes not.To exclude a list of values, put NOT in front.
NOT tags:(prod OR canary)matches alerts with neither tag.tags!:(prod OR canary)means "missing prod, or missing canary", which matches almost every alert.Where the field is not set, NOT also matches alerts. To exclude web01 only among alerts that have a source, write
source is not null AND NOT source:web01.
アスタリスク (*) をワイルドカードとして使用
In a condition, a value without an asterisk must match the whole field. This is the biggest difference from alert search, which matches single words.
例 | 説明 |
|---|---|
| The whole source is exactly web01. |
| Starts with web. |
| Ends with 01. The quotes are required. |
| Contains outage anywhere. |
例
message:outage matches only a message that is exactly "outage". To find the word inside a longer message, write message:"*outage*".
An asterisk only goes at the start or the end.
source:"web*01"andsource:"*"are rejected.No wildcards on tags, actions, responders, priority or snrClassification. These must match a whole entry:
tags:proddoes not match a tag called production.In
details.keyanddetails.value, an asterisk is a normal character.details.key:run*looks for a key named exactly run*.In
detailsPair, the value takes wildcards and the key does not.detailsPair(region:AP*)works;detailsPair(reg*:APAC)is rejected.
Null queries
A null query matches alerts where a field is set, or is not set. A field counts as null if it is not set or is blank.
Supported fields: source, entity, tags, actions, responders.
例 | 説明 |
|---|---|
| The alert has no source. |
| The alert has an entity. |
|
|
|
|
Null queries are rejected on message, alias, description, priority, snrClassification and the details fields. To match the word null as text, quote it: source:"null".
Where you can use it
Alert policies, notification policies, alert group notification policies, routing rules, user notification preferences and role-based notification rules.
Not on integration create-alert rules or sync. Those keep the basic editor.
制限
limit | 値 |
|---|---|
Conditions in one query | 50 |
Grouping depth | 4 levels, counting the top level. The deepest allowed is |
Nested parentheses | 10 |
Query length | 4,000 characters |
Extra parentheses, and repeating the same operator as in a AND b AND c, add no depth.
There is also a fixed limit on how many rules can use an advanced condition. Existing advanced rules can always be edited, even at the limit.
サーフェス | Advanced rules allowed |
|---|---|
Alert, notification and AI notification policies | 1,000 global, and 1,000 per team |
ルーティングルール | 1,000 per tenant |
User notification preferences | 50 per user |
Role-based notification rules | 50 per notification setting |
What gets rejected
Nothing invalid is saved. The error shows where in the query the problem is, and a reason code.
問題 | 例 | Reason code |
|---|---|---|
A word with no field |
|
|
A misspelt or unknown field |
|
|
AND and OR mixed without parentheses |
|
|
Two conditions not joined |
|
|
A null query on an unsupported field |
|
|
An empty value |
|
|
A field this surface does not have |
|
|
A comparison on a field other than priority |
|
|
|
|
|
A value the field does not accept |
|
|
A wildcard on a list field |
|
|
An asterisk in the middle, or on its own |
|
|
Over one of the query limits | 51 conditions |
|
Going over the advanced-rule limit is a separate error with no reason code, for example "You can not have more than 1000 advanced query routing rules."
Behavior worth knowing
Matching ignores case.
source:WEB01matches web01.P1 is the highest priority.
priority > P3returns P1 and P2.A query is saved exactly as typed. Each condition you write counts once toward the limit of 50.
Existing rules keep working unchanged. A rule built in the basic editor behaves as before and opens in the basic editor.
Basic and advanced editors: how conditions map
Switching editors rewrites the same rule in the other form. Nothing changes until you save, and a rule that cannot be switched keeps working as it is.
What each basic condition becomes
Basic editor | クエリ |
|---|---|
source Equals web01 |
|
source Starts With web |
|
source Ends With 01 |
|
message Contains outage |
|
tags Contains prod |
|
source Is Empty |
|
priority Greater Than P3 |
|
Details Contains Key runbook |
|
Details Contains Value checkout |
|
A detail by key: region Equals APAC |
|
classification Equals signal, on an AI notification policy |
|
With NOT: source Equals web01 |
|
Match all conditions | Conditions joined with AND |
Match any condition | Conditions joined with OR |
Values are quoted for you when the query needs it.
What stays in the basic editor
A rule stays in the basic editor if any of its conditions has no query form:
Basic editor | 背景 |
|---|---|
message Matches | A query has no regular expressions. |
message Equals Ignore Whitespace | A query has no way to ignore whitespace. |
Details Contains x | It checks keys and values together, which a query writes as two conditions. Change it to Contains Key or Contains Value, then switch. |
message Is Empty | A null query works only on source, entity, tags, actions and responders. The same goes for alias, description and details. |
message Contains | An asterisk in a value would be read as a wildcard. |
source Equals, with no value | An empty value is not allowed in a query. |
More than 50 conditions | Over the query limit. Trim the rule first. |
A very long value | The query would pass 4,000 characters. |
Match all alerts | There are no conditions to write. |
Advanced back to basic
The same mapping applies in reverse. A query can go back to the basic editor when it is one condition, or several conditions joined by the same operator: priority:P1 AND tags:prod becomes two rows under Match all conditions.
It stays in the advanced editor if it has:
クエリ | 背景 |
|---|---|
| A group inside a group. The basic editor has one level. |
| A negated group. The basic editor can negate one condition, not a group. |
Differences from alert search
In conditions | In alert search |
|---|---|
A value without an asterisk matches the whole field | Matches single words |
An asterisk can lead, trail or enclose a value | Only a trailing asterisk |
Only fields that exist when the alert is created | Also fields that change later, such as status |
Comparisons on priority only, with | More fields, and |
AND and OR need parentheses when mixed | AND binds before OR |
Every pair of conditions needs AND or OR | Two terms side by side mean AND |
Grouping across fields, up to 4 levels | Grouping within one field |
例
What you want | クエリ |
|---|---|
P1 payments alerts, or any P2 in APAC |
|
Outage alerts from production or canary |
|
Urgent alerts not from the monitoring host |
|
Any host in one rack, with no runbook detail |
|
Urgent payments groups that are signal, on an AI notification policy |
|
この内容はお役に立ちましたか?