@BOIA Patricia-Daiana , Thank you for sharing the details regarding this question.
Based on the shared link below, the steps enables the request/response body to log content only in Development Environment.
https://www.azureblue.io/how-to-log-http-request-body-with-asp-net-core-application-insights/
Please refer to the section containing the following
To ensure logging does not get enabled in production environments only enable the custom middleware components inside the condition that checks if we are running in a development environment.
The code snippet uses if (env.IsDevelopment())
condition to enable logging inside the Configure(IApplicationBuilder app, IWebHostEnvironment env)
method. Since your local environment runs as "Development Environment", the logging is available in AppInsights. If you want it to be configured for production as well, you will have to remove the if
condition so that it gets enabled for all environments.
"Note" - I am reiterating the word of caution from Author of this post:
Writing the content of an HTTP body to Application Insight might reveal sensitive user information that otherwise would be hidden and protected in transfer via TLS. So use this with care and only during debugging or developing!
Hope this helps. Please let me know if you have any questions.