Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Insights logs show in Azure Live metrics but not in Transaction search #2923

Closed
lasyan3 opened this issue Jan 15, 2025 · 2 comments
Closed

Comments

@lasyan3
Copy link

lasyan3 commented Jan 15, 2025

Hi,

I have an Azure Function migrated to NET 8 isolated model and I have trouble to have my logs displayed in Azure Insights Transaction Search.

Here is the Program.cs:

var host = new HostBuilder()
    .ConfigureFunctionsWebApplication()
    .ConfigureServices(services => {
        services.AddApplicationInsightsTelemetryWorkerService(options =>
        {
            // Désactiver les logs DEPENDENCY dans le worker (sauf les "Invoke")
            options.EnableDependencyTrackingTelemetryModule = false;
        });
        services.ConfigureFunctionsApplicationInsights();
        services.AddHttpClient(); // for IHttpClientFactory
    })
      .ConfigureLogging(logging =>
      {
          logging.SetMinimumLevel(LogLevel.Information);
      })
    .Build();

host.Run();

And host.json:

{
  "version": "2.0",
  "logging": {
    "applicationInsights": {
      "samplingSettings": {
        "isEnabled": false,
        "excludedTypes": "Request"
      },
      "enableDependencyTracking": false,
      "enableLiveMetricsFilters": true
    },
    "logLevel": {
      "default": "Error",
      "Function": "Error",
      "Function.Update.User": "Information",
    }
  }
}

When I run a function from my computer, the console shows only the logs I want:

Image

Also the Live metrics:

Image

But the Transaction Search is missing those logs, instead I get those weird "Invoke" lines:

Image

Any clue?

@lasyan3
Copy link
Author

lasyan3 commented Jan 15, 2025

Ok I found the issue, following this comment.

But important note: when one adds the Configure block, settings from host.json are ignored.
Also note that adding a default filter does not work either, at least you can add :
options.AddFilter("Microsoft", LogLevel.Error);

@lasyan3
Copy link
Author

lasyan3 commented Jan 15, 2025

Another update: after adding support for settings.json files following this comment, Logging entries are recognized and "Default" works again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant