I am struggling to populate the Log Analytics AppServiceAppLogs sink with application logging. I have a .NET Core Web Api hosted in a Linux hosted App Service Plan and using the default MS ILogger According to the official documentation, AppServiceAppLogs is supported on .NET Core on Linux, but I simply can't get the additional category in Log Analytics.
Here is my existing configuration:
Log Analytics
appsettings.json
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
Program.cs
var builder = WebApplication.CreateBuilder(args);
builder.Logging.AddAzureWebAppDiagnostics();
builder.Services.Configure<AzureFileLoggerOptions>(options =>
{
options.FileName = "azure-diagnostics-";
options.FileSizeLimit = 50 * 1024;
options.RetainedFileCountLimit = 5;
});



Console logs are basically populated from the STDOUT and STDERR and they are mapped to Informational and Error categories.
To send messages to the AppLogs, you can try the following:
"x-ms-applog:informational:base64:base64String" "x-ms-applog:warning:base64:base64String" "x-ms-applog:error:base64:base64String" "x-ms-applog:critical:base64:base64String"
Benefits:
It works for:
For more information: https://learn.microsoft.com/en-us/azure/app-service/monitor-app-service-reference#resource-logs
We are in the process of documenting this.