Webhooks NQL examples
The NQL conditions configuration field within Webhooks supports most of the syntax available in NQL. However, Webhooks is limited to a set of NQL tables, properties and operators.
NQL tables supported by Webhooks
The NQL syntax overview documentation states that the query should begin by specifying the table name: <namespace>.<table>
Find below the supported NQL tables for webhooks.
NQL Object | Valid in Webhook |
---|---|
| Yes |
| Yes |
| Yes |
| Yes |
| Yes |
| Yes |
Refer to the NQL properties supported by Webhooks section on this page for the specific NQL table fields.
Webhooks only supports the NQL tables in the format of <namespace>.<table>
listed above. The system may display an error message when saving a webhook configuration with unsupported NQL objects in the NQL conditions field.
NQL operators supported by Webhooks
Not all NQL operators are at the customer's disposal. When working with punctual events, use the following subset of NQL operators.
NQL Operator | Type | Available in Webhook | Mandatory |
---|---|---|---|
| selection | Yes | Yes, at least once. |
| projection | Yes | Yes, at least once. |
| filtering | Yes | No |
| filtering | Yes | No |
| filtering | Yes | No |
| filtering | Yes | No |
NQL properties supported by Webhooks
Find below the list of fields for each of the supported NQL tables for webhooks.
Remember, using unsupported NQL table fields results in system errors, even for valid syntaxes.
NQL Object | NQL property | Property Type | Operator | Example |
---|---|---|---|---|
|
| String |
|
|
| Boolean |
|
| |
| Enum |
|
| |
| jsonArray |
|
| |
|
| Enum |
|
|
|
| Long |
|
|
| String |
|
| |
|
| String |
|
|
| Long |
|
| |
| Boolean |
|
| |
|
| String |
|
|
| String |
|
| |
| Enum |
|
| |
| String |
|
| |
| Enum |
|
| |
| Enum |
|
| |
| String |
|
| |
| jsonArray |
|
| |
| jsonArray |
|
|
Valid NQL query examples for Webhooks
Some of these valid NQL query examples assume you previously defined the associated alerts
. Refer to the Getting started with Alerts documentation for more information.
Valid NQL example.1 - Trigger a webhook when a monitor named “MS Teams crashes in the last 24 hours"
triggers an alert.
alert.alerts
| where monitor.name == "MS Teams crashes in the last 24 hours"
| list alert.context
Valid NQL example.2 - Trigger a webhook when a monitor with high
priority triggers an alert.
alert.alerts
| where monitor.priority == high
| list alert.context
Valid NQL example.3 - Trigger a Webhook when a monitor named “MS Teams crashes in the last 24 hours"
or “Poor video quality for computers"
triggers an alert.
alert.alerts
| where monitor.name == "MS Teams crashes in the last 24 hours" or monitor.name == "Poor video quality for computers"
| list alert.context
Valid NQL example.4 - Trigger a Webhook when a monitor with high
priority or monitor named “MS Teams crashes for SD"
, and a tag that contains “servicenow"
triggers an alert.
alert.alerts
| where monitor.priority == high or monitor.name == "MS Teams crashes for SD" and monitor.tags contains "servicenow"
| list alert.context
Valid NQL example.5 - Filter the device boots that are equal to fast_startup
and when the duration is greater than 200 seconds.
device_performance.boots
| where type == fast_startup and duration > 200s
| list device_performance.boot.type, device_performance.boot.duration
Valid NQL example.6 - Filter the device crashes by error code 335
or 49
that refer to a timeout situation.
device_performance.system_crashes
| where error_code == 335 or error_code == 49 and label in ["TIMEOUT"]
| list device_performance.system_crash.error_code
Valid NQL example.7 - Filter all the execution crashes for the binary zoom.exe that have crashed on start more than 5 times.
execution.crashes
| where binary_path in ["zoom.exe"] and number_of_crashes >= 5 and crash_on_start == true
| list execution.crash.number_of_crashes
Valid NQL example.8 - Filter remote actions by nql_id
and completed without a status [expired , failure , cancelled ]
.
remote_action.executions
| where remote_action.nql_id == "#update_binary" and status in [expired , failure , cancelled ]
| list remote_action.execution.outputsInvalid NQL query examples for Webhooks
Invalid NQL query examples for Webhooks
Some of these invalid NQL query examples assume you previously defined the associated alerts
. Refer to the Getting started with Alerts documentation for more information.
Invalid NQL example.1 - Unsupported NQL tables, missing the list
operator and wrong usage of the in
operator.
device_performance.system_crashes
| where error_code == 335 or error_code == 49 and label in [*TIMEOUT*]
Invalid NQL example.2 - Unavailable properties and the wrong usage of the in
operator.
alert.alerts
| where trigger_time == "2021-10-23" and monitor.tags in ["*Logitech*"]
| list alert.context
Invalid NQL example.3 - Unavailable operators.
devices
| with alert.alerts during past 7d
| summarize c1 = count() by sid
Invalid NQL example.4 - Unsupported NQL tables.
devices
| where device.operating_system.platform == Windows
| list device.name
Invalid NQL example.5 - Unsupported NQL operators.
devices
| with execution.crashes
| summarize count=count() by operating_system.name
Invalid NQL example.6 - Wrong value when comparing enums.
device_performance.BoOTS | where type == FULLboot
device_PErformance.BoOTS | where type == FULLboot
device_PErformance.BoOTS | where TyPe == FULLboot
device_performance . boots | where type == FullbooT
Invalid NQL example.7 - contains
operator with empty values.
alert.alerts | where monitor.tags contains ""
alert.alerts | where monitor.tags !contains ""
alert.alerts | where monitor.name contains "BSOD"
alert.alerts | where monitor.thresholds contains "ratio_of_slow_pages"
RELATED TOPICS