Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

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
4,559,210
Community Members
 
Community Events
184
Community Groups

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

Hi,

 

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
Atlassian Team members are employees working across the company in a wide variety of roles.
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: https://docs.opsgenie.com/docs/terminology-and-capabilities-of-the-reporting-page#advanced-capabilities

^ 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
Atlassian Team members are employees working across the company in a wide variety of roles.
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

regextagcomm1.jpgregextagcomm2.jpg

@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
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events