Limit noise with email integration filters

Follow

Email filters in PagerDuty email integrations allow you to disregard certain messages arriving at the integration email address. An email's subject, body, and from address can be checked against either a whitelist or blacklist regular expression (regex) filter. Messages that don’t pass the filter will be silently discarded. 

In general, we suggest using Rubular to test your regular expressions. If your regular expression works with the sample text you enter into Rubular, it should work for incidents of the same format in PagerDuty also. Please reference our regex tips and examples article for more information on how regex work.

To set up a regex filter:

      1. Go to the Configuration menu and select Services.

      2. Go to the Integrations tab and click the email integration you want to edit, then click Edit Integration.

      3. Under Email Filters, select one of the email filters:

        • Accept all incoming email: PagerDuty will not filter out any emails that are sent to your integration email address

        • Accept email only if it matches ONE OR MORE rules below: Emails will only be accepted if they match at least one filter rule

        • Accept email only if it matches ALL of the rules below: Emails will only be accepted if they match all filter rules

      4. Configure your rules - whether the email subject, body, and from address should match or not match the regex.

      5. In the edit fields, enter the value to match or not match (this field will not be available if is anything was selected).

      6. Click Save.

      7. Note: Regular expressions are case sensitive. We suggest using a pipe | to capture different upper/lowercase strings. i.e. (Down|DOWN|down)

Below is an example of how to use email filters to filter events based on their critical/noncritical status. In this example, you send emails with the subjects CRITICAL and NONCRITICAL to PagerDuty, but you only want those with CRITICAL in the subject to trigger incidents.

      1. Go to the Configuration menu and select Services.

      2. Go to the Integrations tab and click the email integration you want to edit, then click Edit Integration.

      3. Under Email Filters, select Accept email only if it matches ALL of the rules below.

      4. Add two filter rules:

        1. The first rule should be The email subject matches the regex CRITICAL.

        2. The second rule should be The email subject does not match the regex NONCRITICAL.

        The Accept email only if it matches ALL of the rules below option ensures that both rules will be applied to incoming events. The reason you need both filter rules is because NONCRITICAL contains the word CRITICAL, so the second rule prevents messages with the subject NONCRITICAL from being accepted, even though it contains the word CRITICAL. 

        It's also important to note that regex filters are case sensitive, so if your email subject contains Critical, critical, or any other variation that is not CRITICAL, the message will not be accepted using this example. Email filters cannot be made case insensitive using (?i) like email management rules can. We suggest using a pipe | to capture different upper/lowercase strings if you do not use one case everywhere. For example: (Critical|critical|CRITICAL)

      5. Click Save changes.
Have more questions? Submit a request

Comments