0

We have several APIs deployed on Azure API Management and we have created alerts in AppInsights which triggers when failed APIs are detected.

However, the triggered mail has only information on count of the APIs that have failed. We specifically require the API names and more detail about the failed APIs like request body / response body / API path etc in the alert mail itself.

I guess this can be achieved by custom webhook, but I couldn't find any proper documentation on how the failed API name and other details can be fetched from the Alert payload and can be used in custom payload.

Any guidance w.r.t. custom payload example will be very helpful.

Snehasis Panda
  • 65
  • 1
  • 10

1 Answers1

0

Using custom log query, action group and logic app you can get failed Api names from API management. Below are steps I followed and able to get Api names in mail.

  • I have few api's deployed on Api management.
  • Configured application insights to Api management.
  • Created an alert rule as shown below, enter image description here
    requests
    | where success == false
    | summarize by operation_Name

enter image description here

  • In actions tab, added an action group that will trigger logic app and created rule.

  • The designer of logic app is as shown below, enter image description here

  • In mail body, sending the body of trigger. This will include details about triggered alert.

  • The search result when run query in Azure app insights are,

    // Failed operations 
    // Calculate how many times operations failed, and how many users were impacted. 
    // To create an alert for this query, click '+ New alert rule'
    requests
    | where success == false
    | summarize by operation_Name

enter image description here

  • Once alert triggered, mail will be sent as shown below, enter image description here
  • As shown above, you will get link in mail and once you click on it you will be able to see results with api name as shown below, enter image description here
vijaya
  • 1,525
  • 1
  • 2
  • 6
  • I appreciate the detailed answer. It has helped to some extent. However the requirement was to have the API name of the failed requests in the MAIL BODY itself. Any suggestion w.r.t that will be of great help. Thanks. – Snehasis Panda May 04 '23 at 18:17