Log HTTP response body in Application Insights

Binod Gurung 16 Reputation points

I'm using dot net framework 4.8. I want to log the HTTP request/response body from an API call in application insights. I could find two suggestions:

  1. Use custom telemetry and add a new property in request telemetry and add the extracted request/response to that property. The problem is that the value of the property only supports 8192 characters. But my application can have more characters for the request payload so this approach doesn't fit well for me.
  2. Use the TrackTrace method of the telemetry. It also has a character limit of 32768 and also this tracing should be done manually at every place wherever the API call is done. This is a bit of trouble as I need to update so many places.

Is my understanding correct about these two points? If No please correct me. If Yes, do I have any other solution to store huge request/response body to application insights?

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
3,023 questions
0 comments No comments
{count} vote

1 answer

Sort by: Most helpful
  1. bharathn-msft 5,086 Reputation points Microsoft Employee

    @Binod Gurung Welcome to Microsoft Q&A and thanks for your query.

    Yes, your understanding is correct for two points you have mentioned. Unfortunately , currently we don't have any other solution to store huge request/response body into application insights.

    Our internal team is aware of this customer feedback and will be evaluating the feedback and prioritize it accordingly.

    Hope the above information helps. If you have any other queries, please let us know. Thank you