Home > Back-end >  How can I get .NET Console Logs from Azure App Service to Azure Event Hub?
How can I get .NET Console Logs from Azure App Service to Azure Event Hub?

Time:03-09

I have a .NET 6 project writing application logs to Console using Serilog. The app is hosted on a Windows App Service.

Setup like this:

builder.Host.UseSerilog((ctx, lc) => lc
        .Enrich.FromLogC1ontext()
        .WriteTo.Console(outputTemplate: "[{Timestamp:HH:mm:ss} {Level}] {SourceContext}{NewLine}{Message:lj}{NewLine}{Exception}{NewLine}", theme: AnsiConsoleTheme.Literate);

I have setup a Diagnostic Setting on the App Service to send the logs from Console Output to the Event Hub, but no console logs are sent to Event Hub.

I have also tried enabling HttpLogs, which work fine. So the trigger is working, but how do I get the stdout/Console logs to work?

enter image description here

CodePudding user response:

Probably because, enter image description here

  • Related