Skip to content

General questions on configuring logs #11242

@auslavs

Description

@auslavs

Is your question related to a specific version? If so, please specify:

Function Runtime 4, .NET 8 Isolated

What language does your question apply to? (e.g. C#, JavaScript, Java, All)

F#

Question

I'm finding the process of configuring logs increasing frustrating and confusing. I've spent a week trying to reduce our logs to a sensible amount to reduce the thousands of dollars will are billed month for Application Insights.
To me, the logs and docs are not totally clear on which logs should be configured in code, or via the host.json, and furthermore we are seeing different results from deploying the same app with the same settings to different environments.

We currently have the logging section

    "logLevel": {
      "default": "Information",
      "Microsoft": "Warning",
      "Function.HealthCheck-GET": "Warning"
    }

In code, we have removed the Microsoft.Extensions.Logging.ApplicationInsights.ApplicationInsightsLoggerProvider rule and added the following filters:

options.AddFilter("Microsoft.AspNetCore", LogLevel.Warning) |> ignore
options.AddFilter("System.Net.Http.HttpClient", LogLevel.Warning) |> ignore

In one environment we have successfully removed all the health check logs, however they still persist in another.
I have manually downloaded the deployed zip (we run from package) and confirmed that the same host.json file is in both.

Image

I have also tried adding "Host.Results": "Warning", to the host.json however this removes all "Requests" from the app insights logs.

In summary my questions are:

  1. What is the correct way to remove all information messages for a HTTP trigger, including messages from the app and the host?
  2. Is setting Host.Results to Warning expected to remove all Requests logs from App Insights?
  3. Is there anything I could check other than host.json and filters I have set up in Program.fs that could affect logging? (Note: I have turned off sampling for both environments).
  4. Can we please have some clearer documentation on logging, especially when it comes to Isolated Workers.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions