Is it possible to succeed getting Console App Logs into Log Analytics for an App Service?

Lawrence Brindise 0 Reputation points
2024-10-01T01:38:13.6766667+00:00

I have spent way too much time creating, deleting, re-creating, validating, asking ChatGPT to verify, try again, validate, all day. All I'm trying to do is get a web job, a c# .net 4.7.2 console app running within my azure app service (and whose logs I can see via 3 other ways, so "no console logs" is not the problem), to be seen within a fresh new Log Analytics workspace. This is my first time trying to use this. I have tried various wide open queries in the Log Analytics query window, and I can see other info getting logged (e.g., non-console log info, like metrics, and the other log types available in the "diagnostics settings" panel, but none of my console data is getting logged into this even (or at least I can't see it) though I have asked it to log "app console service logs" into my Log Analytics workspace. When I use a "table" query, I do not see a table that looks like it contains the word "console" in it (which is what I would expect based on the names of the other tables I see that were automatically created based on the log type). I truly believe that with the hours I have spent, I've covered the obvious basics; there really aren't that many settings that should be necessary, and even ChatGPT can't believe this isn't working and has recommended I contact Azure support. Any ideas?

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,960 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Hima Bindu 240 Reputation points
    2024-10-17T14:03:31.5066667+00:00

    Hi @Lawrence Brindise ,

    Welcome to the Microsoft Q&A Platform!
    To get console logs from your C# .NET 4.7.2 console app (running as a Web Job in Azure App Service) into Log Analytics, for that check these things

    Enable Diagnostic Settings:

    Go to your App Service in the Azure portal.

    Navigate to Monitoring > Diagnostic settings.

    Add a new diagnostic setting, and ensure AppServiceConsoleLogs is enabled.

    Select your Log Analytics workspace to route the logs.

    Check Log Analytics:

    In your Log Analytics workspace just run the query:
    AzureDiagnostics

    | where ResourceProvider == "Microsoft.Web"

    | where Category == "AppConsoleLogs"
    For more information refer the link:
    https://learn.microsoft.com/en-us/azure/azure-monitor/essentials/activity-log?tabs=powershell
    If the answer is helpful, please click "Accept Answer" and kindly upvote it.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.