azure-functions-host: Disable Host.Results logs at the function level for HttpTrigger functions

What problem would the feature you’re requesting solve? Please describe.

I have some function apps exposed behind Front Door. 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

image

I managed to disable function logs like that:

{
"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:

{
"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

    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.

About this issue

  • Original URL
  • State: open
  • Created 7 years ago
  • Reactions: 1
  • Comments: 19 (7 by maintainers)

Most upvoted comments

@rwb196884 I’ve created a package to work around this: https://github.com/JackD111/azure-functions-custom-http-telemetry I had to come up with this solution beause our .NET 8 azure function with front door was generating to much traffic

Note: This solution has been designed for Isolated Azure Functions, not in proc ones

Same problem here: ApplicationInsights is being spammed with thousands of useless messages from the health check.

It seems that you have to turn off Host.Results for everything.

Is this is a scam by MS to generate revenue for ingestion?

The heartbeat continues to fill up our logs with heartbeat entries. It would be awesome if this was configurable.

image

I’ve been trying to figure out a workaround to filter out the logs for the healthcheck function using OpenTelemetry so that they are not exported to Azure Monitor, but haven’t got it working yet.

https://github.com/open-telemetry/opentelemetry-dotnet/issues/3918

It would be much better if the Azure Function Host allowed certain functions to be disable from Host.Results.

The ITelemetryProcessor is triggered but there is no item of type RequestTelemetry. Also was checking the Category property but nothing relevant.