Automatically edit alert description before notifying
Asked by Mario Cappellano:

In my organisation, there are hundreds of alerts being piped into Opsgenie, from multiple systems. In many cases they include the full stacktrace error in the description, so when they appear in MS Teams, you need to scroll up for 5 minutes to start from the top.

Is there a way to have Opsgenie truncate the description field for specific errors?

(Yes, the proper fix is to amend the code which generates the alerts, however they come from multiple legacy systems, so while it will happen, it is literally months of work trying to find and understand it all. Hoping there is another solution.)


Answers:
author: Darryl Lee
body: Hi [@Mario Cappellano](/t5/user/viewprofilepage/user-id/4486250) ,

This is Darryl, Opsgenie Support, I am here to help. ?

Understand that you would like to alter the Alert Description upon its creation and right before it got sent to your Microsoft Teams channel.

?? ++Please note that it's not an alert notification, it's considered as outbound Opsgenie integration to output the alert data to Microsoft Teams via [this integration](https://support.atlassian.com/opsgenie/docs/integrate-opsgenie-with-microsoft-teams/).++

The solution here is to leverage the **Alert Policy** to ++automatically alter the description directly onto the Opsgenie Alert++ upon its creation, and this change will be affecting the result sending to your Microsoft Teams.

Here I attach the links to the documentation for Global Alert Policy \& Team Alert Policy for your reference:

Global Alert Policy -\> <https://support.atlassian.com/opsgenie/docs/create-and-manage-global-alert-policies/>

Team Alert Policy -\> <https://support.atlassian.com/opsgenie/docs/create-and-manage-team-alert-policies/>

The difference between these two is with the Global Alert Policy, Opsgenie will try to match every alert that is created on this Opsgenie instance; while the Team Alert Policy only concerns the alerts that go to the same team.

Please add the one that suits you and adjust the Filter and also the Alert Description on the policy.

*** ** * ** ***

Further for your information, here I attach the documentation for Alert Creation Flow for a better understanding of how Opsgenie creates an alert and how the alert details got altered by different factors.

<https://support.atlassian.com/opsgenie/docs/alert-creation-flow/>

Hope this helps.

Kind regards,   
Darryl Lee  
Opsgenie Support

comments: author: Mario Cappellano
body: Thanks Darryl. I gave that a shot, and while I can use that to remove the description entirely from a notification, I don't think I can use it to *truncate* a long description. In many cases I'd like to see the first couple of lines, and then ignore the rest. All good, I didn't expect the ability to be there so I'll work on plan B. ?


author: Darryl Lee
body: Hi [@Mario Cappellano](/t5/user/viewprofilepage/user-id/4486250) ,

That's awesome to know and indeed, there is no way to auto-truncate the description as Opsgenie doesn't get to understand or judge which part of the contents are needed.

We will keep improving this part of the experience.

Thanks for your feedback. ?

Kind regards,   
Darryl Lee  
Opsgenie Support


Tags: cloud