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

Parse one tag value from the tags on the New Relic integration message alert fields

Alexander Blagus Vital de Souza October 28, 2021

Hi everyone!

I have a New Relic integration in my OpsGenie that works pretty well, with working tags incoming from New Relic. I would like to parse the value of a single tag from my notification channel into the Message field of the integration. Please refer to the screenshots bellow:

Screenshot_20211028_134529.png  Screenshot_20211028_134611.png

How do I parse a single tag value in the yellow highlight above?

1 answer

1 vote
Samir
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 28, 2021

Hi @Alexander Blagus Vital de Souza !

 

Tags is an "array" field in Opsgenie, so that's why the {{tags.statusPageAppName}} option isn't working for you. That only works on key-value fields like Extra Properties.

 

For tags, you can use regex or string processing to parse out a specific tag. For example, you could use {{tags.substringAfter("statusPageAppName:")}}

 

Hope that helps!

 

Thanks,

Samir

Alexander Blagus Vital de Souza October 28, 2021

That's quite interesting! Thank you very much for the answer and for the reference links! I'll be testing if this works. 

Have a nice day!!

Alexander Blagus Vital de Souza October 28, 2021

Works like a charm!
I just have to create a better algorithm because the closing braket ("]") is appearing, as expected. I'll refer to the docs to create a refined parser.

 

thank you very so much!

Like # people like this
Alexander Blagus Vital de Souza October 28, 2021

For the final solution I used Regular Expressions. This one works well with another tags or with just one:

{{tags.extract(/(cmp_)([^\,\:]+)/,2)}}

Screenshot_20211028_162344.png

As seen, I am using the existent cmp_ tags already used for the StatusPage integration.

Like Steffen Opel _Utoolity_ likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events