Azure APIM - Log All request and response headers

Nagashree Balasundaram 731 Reputation points
2022-06-22T17:58:26.36+00:00

Is there a way to log all the request and response headers in Azure APIM for all APIs? (at a global level)

Specifically log req and response headers for error cases

I tried the solution posted in https://learn.microsoft.com/en-us/answers/questions/418811/capture-header-parts-of-request-body-in-apim-log-a.html which is specific to each API

Do you need to list each and every header to be logged? Under "Headers to Log" section - i tried specifying a *, it doesnt seem to take effect.

Azure API Management
Azure API Management
An Azure service that provides a hybrid, multi-cloud management platform for APIs.
1,739 questions
0 comments No comments
{count} votes

Accepted answer
  1. MayankBargali-MSFT 68,391 Reputation points
    2022-06-27T14:07:20.727+00:00

    @Nagashree Balasundaram Thanks for reaching out. If you want to log at the global level, then you need to specify the settings at the All API level as below.

    • Navigate to "All APIs" (or the specific API if you wish to apply the logging setting at specific API scope)
    • Click on "Settings"
    • Click "Azure Monitor"
    • Add the desired headers to 'Headers to log"
    • Save

    Any headers that are part of the incoming request can be logged in Log Analytics/Azure Monitor. Yes, you need to specify all headers that you want to be logged.
    By Default: no headers are logged and * will not work. You can refer to this document for all the supported settings and their value types.

    Feel free to get back to me if you need any assistance.

    Please 'Accept as answer' and ‘Upvote’ if it helped so that it can help others in the community looking for help on similar topics.

    3 people found this answer helpful.

0 additional answers

Sort by: Most helpful