I have 10+ azure function apps deployed. Out of them only one function app always writes a trace message "Executing HttpStatusCodeResult, setting HTTP status code 200" every 10 seconds. I can not find the source from where this log is coming. My host.json looks like below
{
"version": "2.0",
"logging": {
"fileLoggingMode": "debugOnly",
"LogLevel": {
"Default": "Information"
}
},
"extensions": {
"http": { "routePrefix": "api" }
}
}
When you have some unwanted logs in application insights, click on it and see what's the category:

As you can see, the category is Microsoft.AspNetCore.Mvc.StatusCodeResult and the severity level is Information.
What I did was to ignore all the logs with lower level than Warning from all the categories starting with Microsoft. I configured it in the host.json file:
{
"version": "2.0",
"logging": {
"fileLoggingMode": "always",
"logLevel": {
"default": "Information",
"Host.Controllers.Host": "Warning",
"Microsoft": "Warning"
}
}
}
As you can see, I also set Warning value to Host.Controllers.Host to avoid messages like Ping Status: { "hostState": "Running" }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With