Filters

Filters are used with many features of OpsGenie, to provide action execution based on certain conditions. You can customize integration actions to be processed with certain incoming data, callbacks to be fired for particular types of alerts, policies to be applied to certain alerts, etc.

For example, OpsGenie processes every incoming data associated with your integration; and evaluates them against your integration's actions for execution. Remember that integration actions have a processing order; and at most one action can be executed on a single webhook. If the first action's condition set, in other words Filter, does not match the incoming webhook data, OpsGenie moves on to the next action in line and evaluates its Filter. If an action's Filter matches the data, OpsGenie executes that action and ends the processing on that particular webhook. If no matching action is found, nothing happens.

The figure below shows a Create Alert action's Filter. Its condition match type is set to 'Match one or more conditions below'; so if the variable 'Status Message' in the incoming data is equal to 'Failed' or 'Still Failing', then an OpsGenie alert will be created according to the setup specified in the Alert Fields; and the processing will end there. If, however, an incoming data with 'Status Message' equal to something other than these comes to OpsGenie, it will be evaluated against the Create Alert action and when that doesn't match, the Filter of the Close Alert below will be processed.

OpsGenie provides default actions with pre-configured Filter and Alert Fields for every integration. However; you can customize them any way you like: you can edit them, delete them or add new actions of your own.

There are different types of 'condition match type' that you can choose from:

  • Match all alerts: When this option is selected, the integration action will match every data that's evaluated against it and cause the action to be executed. No specific condition is specified when this option is selected.
  • Match one or more conditions below: With this option selected, if any one of the conditions that are specified in the condition set matches the incoming data, it's sufficient for OpsGenie to go on and execute the integration action.
  • Match all conditions below: With this option selected, it's required for the webhook data to match every specified condition in the condition set. If any of them fails, the action will not be executed and OpsGenie will move on to the next integration action to process, if there is any.

If 'Match one or more conditions below' or 'Match all conditions below' is selected, you will need to specify a list of conditions to evaluate. A single condition looks like:

The four boxes denote in order:

  1. The variable in the specific integration's webhook data to evaluate.
  2. 'Is' or 'Is Not' clause.
  3. The functional operation that the variable is expected to comply. The set of operations you can choose from changes according to the type of the variable.
  4. The value field the incoming data is expected to match.

You can add new conditions to the condition set by clicking on the plus sign, or delete using the bin sign. Remember that all the changes you make will be applied after you save changes.

Condition Operations

Equals

It is applicable for String, Boolean and Number variable types. It returns true if the specified variable's value and the expected value are the same.

Contains

It is applicable for String, List and Map types. It returns true if the specified variable's value contains the expected string. For maps, expected value can be contained by key or by value fields.

Is Empty

It is applicable for String, List and Map types. It returns true if the specified variable is empty. For string it checks character count, for list and map, it checks size.

Matches (Regex)

It is applicable for String, List and Number types.

  • For String and Number types, it returns true if the specified value matches the given regular expression.
  • For List types, it returns true if any of the given values matches the given regular expression.

Contains Key

It is applicable for Map type. It returns true if the specified variable contains the expected value in keys.

Contains Value

It is applicable for Map type. It returns true if the specified variable contains the expected value in values.

Starts With

It is applicable for String type. It returns true if the specified variable starts with the expected value.

Ends With

It is applicable for String type. It returns true if the specified variable ends with the expected value.

Greater Than

It is applicable for Number type. It returns true if the specified variable is greater than the expected value.

Less Than

It is applicable for Number type. It returns true if the specified variable is less than the expected value.

Equals Ignore Whitespace

It is applicable for String type. It returns true if the specified variable is equal to the expected value after removing all whitespace(space, tab, new line, carriage return characters) from both the specified and the expected value.