how to log the response and request in API Management

Viewed 7787

how to log the response size ,request size, error message from API management instance? If yes then how can I fetch the data from it.

2 Answers

There is an inbuilt "log-to-event-hub" policy that you can use to send basically any information that exists on the context object (meaning the request/response + a bit more) to an event hub. From there you can use any regular method for processing the events

How to log events to Azure Event Hubs in Azure API Management.

Use Azure Monitor to configure diagnostic logs from ApiManagement to either Storage, Eventhub or Log Analytics. These logs have the data you are looking for.

I would start with free tier of Log Analytics for easy querying, dashboards and alerting. Refer this.

For more custom logging, you can use log to event hub policy. Refer this blog.

Related