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.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.