Search code examples
azure-web-app-serviceconsole.logazure-appservice

Azure Monitoring Diagnostic Settings AppServiceConsoleLogs not showing all console.log lines


We have set up Azure Diagnostic Settings (preview) AppServiceConsoleLogs to log all of our nodejs console.log() lines. These are being stored both in the Log Analytics workspace and archived to our Azure storage account.

I have noticed that it is indeed capturing many of the console.log() lines from our node.js application. However, nowhere close to all. It SEEMS to be random - that some of the console.log lines are captured while others are not. I am going to guess that it is capturing somewhere around 10-25% of the console.log lines in the nodejs code.

I have seen online that there is a difference between "Information" (or "Informational") and "Detailed". And indeed, in the Query tool, there is a "Level" column, where in mine it only has "informational" rows. However, I don't see a place in my set up where I can choose "Detailed".

Here is how we have it set up with screenshots...

In the App Service, under "Monitoring" & "Diagnostic settings (preview)...

enter image description here

Then, clicking on "Edit settings", we have... enter image description here

Then when I click on "View logs" under "Search and analyze logs" in the DefaultWorkspace, and then select "AppServiceConsoleLogs", I get this screen, which clearly DOES show some of our app's console.logs (such as the circled at the top - "Got the order from orderH____"). but nowhere close to all of the console.logs. As circled as well, the Level is "Informational". When I click on the filter and select "is not equal to" "Informational", it shows nothing. enter image description here

If I Export to CSV and look at it - of course, the same thing.

I cannot find anywhere to tell it I want to log "Detailed" rather than "Informational".

Perhaps as a side note, here is what our Monitoring App Service Logs screen looks/is set up like. "Application Logging" is "Off". I'd turn that on to try to see if it makes a difference, but since it is already logging SOME of our console.logs, and when I click on "File System", it doesn't show anything about "Detailed" logging, I'd rather not try it unless I really know what I am doing. enter image description here


Solution

  • I ended up figuring this out.

    I did need to turn on "Application Logging" from "Off" to "File System" (see just above at the end of my question). Even though there is no "Informational" vs. "Detailed" setting (apparently Azure got rid of that setting and just defaults it to "Detailed"??), it is now giving me VERY detailed logs - ALL of my console.logs plus more!

    Then I went to "Diagnostic settings (preview)" from the sidebar under "Monitoring". Then clicked on the "defaultworkspace" link. Then you click on "View logs" under "Search and analyze logs at the bottom of the "DefaultWorkspace" screen.

    This then sends you to a screen with a lot of pre-defined queries you can run, or you can just click on the "x" and run queries over your logs for the last 24 hours, or any timeframe you want!