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:
- The variable in the specific integration's webhook data to evaluate.
- 'Is' or 'Is Not' clause.
- 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.
- 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.
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.
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.
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.
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.
Regex match operations has 10 seconds timeout limit. If it takes more than 10 seconds, it returns false.
It is applicable for Map type. It returns true if the specified variable contains the expected value in keys.
It is applicable for Map type. It returns true if the specified variable contains the expected value in values.
It is applicable for String type. It returns true if the specified variable starts with the expected value.
It is applicable for String type. It returns true if the specified variable ends with the expected value.
It is applicable for Number type. It returns true if the specified variable is greater than the expected value.
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.
For any action set up for an integration, an Alias must be defined and match exactly in order for the action to be executed. The Alias field is a user-defined unique identifier for "open" alerts. Also used in de-duplication, integrations are unable to be saved if an Alias field is left empty, nor will actions be functional.