Reputation: 705
we have just added Application Insights to our WebAPI 2.2 application and it looks like a winner. However, we have some controllers that receive sensitive information that we cannot store due to compliance regulations, even in Application Insights. We want to capture information level trace events on some of our controllers, but we need to not capture or obscure the information when sent through other controllers. Can anyone suggest a way that we can achieve that?
Upvotes: 1
Views: 1409
Reputation: 705
I asked the same question on the Azure MS website and got a reply that works well.
Anyone looking here for an answer should look there.
Upvotes: 1
Reputation: 13869
Since you're using the Microsoft.ApplicationInsights.TraceListener package, I don't think there's any way to directly filter the data. If you can add something special to the Trace.WriteXxx() call, then one option might be to implement a TraceFilter and register it through your configuration for the ApplicationInsights Trace Writer.
Then in your TraceFilter.ShouldTrace(), you could check for that special value (maybe it's the event ID, maybe some prefix in the trace message, or something like that) and simply return false to cause it to be skipped.
Upvotes: 1