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

  1. Open the rule or policy you want to edit, or create a new one.

  2. In the alert filters section, switch from Basic to Advanced.

  3. Enter your query. When you select outside the field, we validate the query and show any errors.

  4. [保存] を選択します。

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.

条件

説明

message:"Disk full"

The alert message.

description:"*timeout*"

The alert description.

alias:host_down

The alert alias.

entity:web01

The alert entity.

source:monitor01

The alert source.

priority:P1

P1 to P5. The only field that works with > and <.

tags:prod

One of the alert's tags. tag also works.

actions:restart

One of the alert's actions.

responders:"Payments Team"

A team or user on the alert, by full name. responder, recipient and recipients also work.

details.key:runbook

The alert has a detail with this key.

details.value:checkout

One of the alert's details has this value.

detailsPair(region:APAC)

The detail region has the value APAC.

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:

条件

説明

message:"*payments*"

The group's title, generated when the group is formed. It is not any single alert's message.

priority:P1

The group's priority.

tags:payments

The group's tags.

snrClassification:signal

The group's classification: signal or likely_noise.

条件演算子

例

説明

source:web01

Equals. source=web01 is the same.

source!:web01

Does not equal. != and <> are the same.

priority > P3

More urgent than P3, so P1 or P2.

priority < P3

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.

例

説明

source:"web 01"

A value with a space.

message:"it's down"

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:

例

説明

tags:(prod OR canary)

The alert has the prod tag or the canary tag.

tags:(prod AND eu)

The alert has both tags.

Combine conditions with AND, OR and NOT:

例

説明

priority:P1 AND tags:prod

Both match.

(priority:P1 AND tags:prod) OR source:web01

Mixing AND and OR. The parentheses are required.

NOT source:web01

The source is not web01, including alerts with no source.

  • Mixing AND and OR needs parentheses. priority:P1 AND tags:prod OR source:web01 is 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:prod is rejected. Write source:web01 AND tags:prod.

  • Write AND, OR and NOT in upper or lower case. and works; And does 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.

例

説明

source:web01

The whole source is exactly web01.

source:web*

Starts with web.

source:"*01"

Ends with 01. The quotes are required.

message:"*outage*"

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" and source:"*" are rejected.

  • No wildcards on tags, actions, responders, priority or snrClassification. These must match a whole entry: tags:prod does not match a tag called production.

  • In details.key and details.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.

例

説明

source is null

The alert has no source.

entity is not null

The alert has an entity.

tags:null

tags is null と同じ。

actions!:null

actions is not null と同じ。

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 priority:P1 AND (tags:a OR (source:b AND (entity:c OR alias:d))).

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

web01

SYNTAX_ERROR

A misspelt or unknown field

Message:down

SYNTAX_ERROR

AND and OR mixed without parentheses

priority:P1 AND tags:prod OR source:web01

SYNTAX_ERROR

Two conditions not joined

source:a tags:b

SYNTAX_ERROR

A null query on an unsupported field

message is null

SYNTAX_ERROR

An empty value

source:""

SYNTAX_ERROR

A field this surface does not have

source:web01 on an AI notification policy

UNDECLARED_FIELD

A comparison on a field other than priority

alias > foo

COMPARATOR_ON_NON_ORDINAL

>= または <=

priority >= P3

UNSUPPORTED_COMPARATOR

A value the field does not accept

priority:P6

INVALID_VALUE

A wildcard on a list field

tags:prod*

WILDCARD_ON_LIST_FIELD

An asterisk in the middle, or on its own

source:"web*01"

INVALID_WILDCARD

Over one of the query limits

51 conditions

OVER_CAP

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:WEB01 matches web01.

  • P1 is the highest priority. priority > P3 returns 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:web01

source Starts With web

source:web*

source Ends With 01

source:"*01"

message Contains outage

message:"*outage*"

tags Contains prod

tags:prod. On tags, actions and responders, Contains means "has this entry".

source Is Empty

source is null

priority Greater Than P3

priority > P3

Details Contains Key runbook

details.key:runbook

Details Contains Value checkout

details.value:checkout

A detail by key: region Equals APAC

detailsPair(region:APAC)

classification Equals signal, on an AI notification policy

snrClassification:signal

With NOT: source Equals web01

source!: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 ^err.*

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 50*off

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:

クエリ

背景

priority:P1 AND (tags:prod OR source:web01)

A group inside a group. The basic editor has one level.

NOT (tags:prod OR source:web01)

A negated group. The basic editor can negate one condition, not a group.

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 > or <

More fields, and >= 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

(priority:P1 AND tags:payments) OR (priority:P2 AND detailsPair(region:APAC))

Outage alerts from production or canary

message:"*outage*" AND tags:(prod OR canary)

Urgent alerts not from the monitoring host

priority > P3 AND source is not null AND NOT source:monitor01

Any host in one rack, with no runbook detail

source:rack12* AND NOT details.key:runbook

Urgent payments groups that are signal, on an AI notification policy

tags:payments AND priority > P3 AND snrClassification:signal

 



さらにヘルプが必要ですか?

アトラシアン コミュニティをご利用ください。