How to get logs through Diagnostic Setting in Azure App Service (Node.js stack)

Ayush Saran 5 Reputation points
2023-09-05T05:47:37.92+00:00

Hi All, I am looking to get the console and app logs from Azure App Service streamed through Event Hub so I can further pipe it to my third party logging system. But unfortunately, I am not able to get any logs from Azure App Service (Windows-Node.js) even after I have enabled diagnostic setting (AppConsoleLogs,AppLogs etc). We have used standard commands such as console.error and console.log. Is there a limitation on language stack or do I have to anything else? Thank you

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

1 answer

Sort by: Most helpful
  1. Ryan Hill 27,771 Reputation points Microsoft Employee
    2023-09-05T23:35:59.3666667+00:00

    Hi @Ayush Saran

    For your original question, there isn't any limitation on language stack. Whichever stack you're using, the logging gets piped in by default. Verify that your app is actually generating logs by using Log Stream in the portal or kudu console under Log Files (yourappname.scm.azurewebsites.net/api/vfs/LogFiles/). On Windows, you can also select Debug Console > CMD > Logfiles for an explorer type view.

    Once you confirm your app is generating logs, then ensure the correct destination is selected for logs, i.e., Event Hub, Log Analytics Workspace, Storage Account. Specifically for Event Hub, you should be able to use the Azure portal to check if logs are being streamed to your destination resource on the resource itself.


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.