Welcome to Microsoft Q&A Platform!
Thanks for reaching out. To log all request and response data of an API hosted on Azure API Management in Application Insights, you can use the log-to-eventhub policy. This lets you send details from the request and response to an Azure Event Hub for logging and monitoring.
Here’s how you do it:
- Set up a connection between Application Insights and your API Management service using the Azure portal or REST API.
- Turn on Application Insights logging for your API(s) by going to your API Management service instance, picking the API, and enabling diagnostics logs.
- Set up the log-to-eventhub policy in your API Management service to capture the entire HTTP request and response message. This way, you can send that message to a third-party service or store it for auditing and analytics.
By following these steps, you’ll ensure that the complete request and response data is logged effectively.
References:
- How to integrate Azure API Management with Azure Application Insights
- Monitor your APIs with Azure API Management, Event Hubs, and Moesif
Hope this helps. Do let us know if you have any further queries.
If this answers your query, do click Accept Answer and Yes for "Was this answer helpful." And if you have any further questions, let us know.