In my azure solution, I have 1 app service and 2 function apps logging to 1 application insights instance. In a specific environment I want to reduce the logging load, so I wanted to get rid of severity-level-0 logs.
I am currently focusing on one of the function apps, let's call it fa1. The logging statements I add with ILogger as LogDebug do not show up in application insights, as expected. However I can see the following entries in application insights:
- "Poll for function '{name of function in fa1}' on queue '{...}' with ClientRequestId '{...}' found 0 messages in 5 ms."
- "Function '{name of function in fa1}' will wait 60000 ms before polling queue '{...}'."
I also see the following entries, but I do not know which service is generating them:
- "[HostMonitor] Host process CPU stats: EffectiveCores=1, CpuLoadHistory=(0,0,0,0,0,0,0,0,0,0), AvgCpuLoad=0, MaxCpuLoad=0"
- "[HostMonitor] Host aggregate CPU load 0"
host.json:
{
"version": "2.0",
"logging": {
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"excludedTypes": "Request"
}
},
"logLevel": {
"Function": "Warning",
"default": "Warning"
}
}
}
Startup.Configure():
builder.Services.AddLogging(loggingBuilder =>
{
var key = Environment.GetEnvironmentVariable("APPINSIGHTS_INSTRUMENTATIONKEY");
loggingBuilder.AddApplicationInsights(key);
});
builder.Services.AddSingleton(sp => // Needed for injected ILogger<> to log in AI
{
var key = Environment.GetEnvironmentVariable("APPINSIGHTS_INSTRUMENTATIONKEY");
return new TelemetryConfiguration(key);
});
I tried loggingBuilder.AddApplicationInsights(key).SetMinimumLevel(LogLevel.Warning);
as well.
None of the settings worked, the logging entries mentioned above kept appearing.
Note that I am setting Warning just for testing. At the end I want Information.
What can I do to get rid of those severity-level-0 logging entries?