Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

How to use the "contains" filter on a policy to match alerts on tags?



I'm trying to define a new "delay" policy that would delay until the next morning my alerts that have a tag that contains the "test" string.

I created the policy as shown in the picture below:Screenshot from 2021-02-16 19-34-25.png

I'm using Lamp to test my alerts:

  • If I send an alert with:
    opsgenie-lamp createAlert --message "hello world" --tags "test"
    Then the filter matches, and my alert is correctly delayed.
  • If I send an alert with:
    opsgenie-lamp createAlert --message "test jon" --tags "test 123"
    Then the filter doesn't match, the alert is not delayed and I'm paged instantly. I tried various combination of the tag value: "test123", "test-123", "test 123", the filter doesn't match.

I could use a regex for that, but I wanted to be sure I understood "contains" correctly (does it actually mean "equal"?)

Thanks for your help!

1 answer

1 accepted

2 votes
Answer accepted
Nick H Atlassian Team Feb 16, 2021

Hi @Jonathan Ballet ,

When filtering by tags and/or teams, please use the 'contains' operator and enter the full tag/team name. These two attributes are list attributes and the 'contains' operator would search for the specific tag/team typed within the list:

^ Although the doc outlines this in reporting, the same goes for filtering tags in policies, integrations, etc. 

Regex can also be used like you mentioned as well! Hope this helps. Let us know if you have any other questions around this.

Hi @Nick H

Thanks for your answer! If I understand correctly, "contains" is for when there's a list of values, such as a list of tags, and the filter would lookup one of the value of the list, right?

It possible to combine both behaviors? Ideally, Id' like to filter my alerts if any of the tags value matches the regexp ".*test.*", would that work?

Nick H Atlassian Team Feb 16, 2021

That's correct. Tags will always be in a list since they are parsed as an array in the payload. Regex can act like the "contains" condition using an expression like yours.

For example with the test below (no pun intended) - I have a policy that filters using regex, and applies to alerts that match .*(test).* in the tag.

I even added "test" in the middle of the tag to show how it can act like "contains" in this example: thisisatestforjb


@Nick H Thanks a lot, I'll try with this type of filters then!

Like Nick H likes this

Suggest an answer

Log in or Sign up to answer
Site Admin
Community showcase
Published in Confluence

An update on Confluence Cloud customer feedback – June 2022

Hi everyone, We’re always looking at how to improve Confluence and customer feedback plays an important role in making sure we're investing in the areas that will bring the most value to the most c...

244 views 2 5
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you