Capture header, parts of request body in APIM (Log Analytics vs Application Insights)

PK 326 Reputation points
2021-06-02T06:22:04.037+00:00

Hello,

I need to capture the header, parts of the request body from the requests sent to the APIM.

We have application insights and log analytics available in the APIM blade. What would be the best
option to capture the requests and how to achieve the same.

Thanks,
PK

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

Accepted answer
  1. MayankBargali-MSFT 70,941 Reputation points Moderator
    2021-06-02T07:31:14+00:00

    @PK You can use any (Log Analytics or Application Insights) to capture the request and response body.
    Sharing previous discussion on stackoverflow what to choose.

    For the configuration you can refer to this.

    Under the Diagnostic Logs setting --> Azure Monitor/Application Insights you need to enable the Additional settings and specify the payload as per your requirement. For testing I am logging everything and specify the max payload (8192). Make sure to change the payload value from 0 else the log will not be collected.

    101613-image.png

    Once I have updated the setting you can see the logs are getting captured correctly.

    101657-image.png

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

    3 people found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Rob Bowman 221 Reputation points
    2022-08-04T12:10:08.227+00:00

    apimanagementgatewaylogs doesn't seem to be a valid source?

    228135-image.png


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.