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

Parsing ResultsJSON within SumoLogic payloads

Cameron McAuley August 23, 2024

The SumoLogic integration allows you to add the `ResultsJson` from a given Sumologic payload. This can be added to the description of your alert as follows {{ ResultsJson }}

However, it can look quite messy. The format of this ResultsJson is a full JSON array that can contain multiple JSON objects within it (each JSON object will have the same fields).

For example, what if I wanted to extract `env` out of this ResultsJson:

[{"Timeslice":1724426340000,"avg":12.2584685,"env":"stage-env"},{"Timeslice":1234567894666,"avg":12.2584685,"env":"prod-env"},{"Timeslice":3566463246466,"avg":12.2584685,"env":"stage-env"}]

I have tried {{ ResultsJson.env }} but it did not work. I then tried something like this {{ ResultsJson.[0].env }} with the expectation that it might display just the first result within my SumoLogic payload. But it seems that `[]` aren't accepted

I have read articles and answers here on using {{ _payload }}. It is not clear to me if this works in the case of having a full JSON array within that a _payload field.

 

1 answer

0 votes
Shashwat Khare
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 26, 2024

Hello @Cameron McAuley ,

This is Shashwat from Opsgenie support and here to help! :) 

Yes, you can use the _payload operator to bring in the entire JSON payload into the Opsgenie alert description field.

For extracting exact variable values like env out of the above JSON, we would recommend using one of the string operators from the below help document from substringBetween, substring(int from), substring(int from, int to) OR extract(regular expression): 
https://support.atlassian.com/opsgenie/docs/string-processing-methods-in-opsgenie-integrations/ 

Best,
Shashwat

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events