How to configure applications insights telemetry in azure

We have installed Sitecore 9.0.2 from the marketplace bundle into Azure (small), as part of this there is an application insights. 

My problem is that I would like to configure how this works, what is logged, how often and so forth. The standard installation reaches the daily data cap (.33GB) in a matter of hours. There is very little of this information I need, so it seems pointless to upp the data limit. 

I am unable to find any good documentation, but I've found the following config files: 

ApplicationInsights.config in the base of the site (and seems to be the same file for all 4 roles (cm,cd,prc,rep)

/app_config/sitecore/Sitecore.Cloud.ApplicationInsights.config (with small differences between the roles, mainly role name)

 

What I want is to limit performanceCounters to collect data every 5 minutes, and only a limited amount of counters like mem/cpu

I also want to remove all "INFO" from the trace log. 

 

What I have done so far is removing all counters from Sitecore.Cloud.ApplicationInsights.config: 

<includedCounters hint="raw:AddCounterToReport">
<!-- <add category="Sitecore.Data" name="Data | Client Data Reads / sec" /> -->
<!-- <add category="Sitecore.Data" name="Data | Client Data Writes / sec" /> -->

No real effect, as all the mem/cpu and so on counters are not represented here and is still logged every 5 sek. 

Changed ApplicationInsights.config

<Add Type="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.AdaptiveSamplingTelemetryProcessor, Microsoft.AI.ServerTelemetryChannel">
<MaxTelemetryItemsPerSecond>5</MaxTelemetryItemsPerSecond>
<MaxSamplingPercentage>10.0</MaxSamplingPercentage>
</Add>

Seems to have reduced it somewhat, but I do NOT want to remove any warnings/errors from the log and I'm very unsure as to what these settings actually limit. 

Next I've added a patch (And showconfig show me it works)

<root>
<priority value="INFO">
<patch:attribute name="value">WARN</patch:attribute>
</priority>
<appender-ref ref="LogFileAppender" />
</root>

But I'm still getting hundreds of info warnings, mainly ManagedPoolThread #5 08:39:25 INFO 0 SMTP connections disposed. from the CM server

Anywone have any tips/links ?

  • Go into the app's /sitecore/admin/showConfig.aspx page and look for the <log4net> section - this will have all the appenders and it should be obvious from the data which components are logging to file and which to AI. Importantly you'll notice there are several appenders set to "INFO" by default, that should be set to "WARN".


    Might I suggest, a better way to set the value in the config is like this:

    <priority set:value="WARN" />

    It's just easier to read and follow - you need to ensure that you have the "set" namespace configured in alongside "patch" -
    xmlns:set="www.sitecore.net/.../"