I'm trying to figure out a better way to do some formatting on JSON arrays that I'm receiving through SumoLogic webhook.
I have the description of my integration set like this:
"""
username: {{_payload.username}}
authDevIP: {{_payload.authDevIP}}
"""
And the alert will show up like this:
"""
username: user1
user2
user3
user4
authDevIP: 10.0.0.1
10.0.0.2
10.0.0.3
10.0.0.4
"""
I think it would be a little more readable like this:
"""
username: user1 user2 user3 user4
authDevIP: 10.0.0.1 10.0.0.2 10.0.0.3 10.0.0.4
"""
Ideally, there would be tabs or commas, but the main thing would likely be to get horizontal formatting.
Is there a way to do that easily with an array?
I know I could try to use a .get() like is mentioned in this documentation (Dynamic fields in Opsgenie integrations | Opsgenie | Atlassian Support), but I don't know how many iteams will be in these arrays.
What I would wonder is whether there could be an option as to what items in a list are joined on.
Since the data to Opsgenie is just an array, it seems that there is just a default handling that says that the items in the array are joined on a newline character.
If there was a formating function like .get() for an array that allowed a joining character to be specified, that would solve the issue.
eg. If I sent
{usernames : [user1,user2,user3]}
I could use
{{_payload.usernames}}.join(" ") or {{_payload.usernames}}.join("\t")
Hello,
Opsgenie is not able to handle String parsing when creating alerts. I would recommend doing it on Sumologic alert configuration side.
Please do not forget to accept this answer in case it helps you resolve your issue as it may help other community members in the future.
Regards,
Eugenio
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.