Azure / Azure/azure-functions-host
Disable Host.Results logs at the function level for HttpTrigger functions
- Dominant language
- C#
- Stars
- 2k
- Forks
- 482
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 36
Description
#### What problem would the feature you're requesting solve? Please describe.
I have some function apps exposed behind [Front Door](https://azure.microsoft.com/en-us/services/frontdoor/). Each application has an health-check endpoint (HttpTrigger).
Front door is calling these health endpoints quite a lot and I have a lots of requests logged to app insights

I managed to disable function logs like that:
```json
{
"logging": {
"logLevel": {
"Function.health-check": "Warning"
}
}
}
```
But the requests (Host.Results category) are still logged to app insights which increase significantly app insights billing.
#### Describe the solution you'd like
I'd like to be able to specify `Host.Results` logs at the function level, so I can do something like that:
```json
{
"logging": {
"logLevel": {
"Host.Results.health-check": "None"
}
}
}
```
#### Describe alternatives you've considered
- I've already reconfigured Azure Front Door to only call the health endpoint once per second.
- I've tried to hook up my own `ITelemetryProcessor` to filter some `Host.Results` logs as describe here: [ITelemetryProcessor does not appear to be supported in Function Apps](https://github.com/Azure/azure-functions-host/issues/3741)
```
public void Process(ITelemetry item)
{
// Exclude Health check
var request = item as RequestTelemetry;
if (request != null)
{
if (request != null && request.Name == "health-check")
{
return;
}
}
Next.Process(item);
}
```
While debugging, I could find any `RequestTelemetry` and inspecting the `ITelemetry item` there was no item with category `Host.Results` so I was a little bit stuck on that part.
Contributor guide
Research direction
Start by tracing how the Host.Results category is emitted for HttpTrigger requests and how the existing Function.health-check log-level rule is applied. Verify that a function-level Host.Results.health-check setting suppresses health-check results in Application Insights while leaving other Host.Results entries available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, csharp
- Domain
- backend, observability
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100