Application Insights SDK for asp.net core is always inserting a custom dimension called "AspNetCoreEnvironment" with the value "Production" on my requests, dependencies, traces and etc...
How can I disable this?
Whenever we configure Application Insights for a WebApp, by default AspNetCoreEnvironment
can be seen under Custom properties
of a Request
,Custom Event
and even on Trace
Logs.
In Program.cs
file, after
builder.Services.AddApplicationInsightsTelemetry(builder.Configuration["APPLICATIONINSIGHTS_CONNECTION_STRING"]);
I have added the below line of code.
builder.Services.RemoveAll<ITelemetryInitializer>();
Now I can see that the AspNetCoreEnvironment
property is excluded from the logs.
Request:
Custom Event and Trace: