Question

Difficulty: Very hardDiagnose and Log App Service Web Apps

You are configuring diagnostic logging for a Node.js web application hosted on an Azure App Service running on a Linux plan. You need to configure a diagnostic setting using the Azure CLI to stream both the application container's standard output/error (stdout/stderr) streams and the web server's HTTP request logs to a Log Analytics workspace. Which JSON array should you pass to the `--logs` parameter of the `az monitor diagnostic-settings create` command to achieve this?

  1. [{"category": "AppServiceConsoleLogs", "enabled": true}, {"category": "AppServiceHTTPLogs", "enabled": true}]Answer
  2. B
    [{"category": "AppServiceAppLogs", "enabled": true}, {"category": "AppServiceHTTPLogs", "enabled": true}]
  3. C
    [{"category": "AppServiceConsoleLogs", "enabled": true}, {"category": "AppServicePlatformLogs", "enabled": true}]
  4. D
    [{"category": "AppServiceConsoleLogs", "enabled": true}, {"category": "AppServiceAuditLogs", "enabled": true}]

Answer

The configuration that contains both AppServiceConsoleLogs and AppServiceHTTPLogs with enabled set to true.
For Linux-based App Services, application console outputs (stdout/stderr) are collected under the AppServiceConsoleLogs category, and the HTTP request logs are collected under the AppServiceHTTPLogs category. Thus, enabling these two categories routes the desired telemetry to the Log Analytics workspace.

Step-by-Step Solution

1
Identify the hosting operating system for the App Service.
The web application is hosted on Linux.
Logging behavior in Azure App Service differs significantly between Windows and Linux platforms.
2
Determine the correct log category for Node.js application stdout/stderr streams on Linux.
The correct category is AppServiceConsoleLogs.
On Linux App Service, standard output and standard error from the application container are captured by App Service as Console logs, whereas Windows App Service uses AppServiceAppLogs.
3
Determine the correct log category for web server HTTP request logs.
The correct category is AppServiceHTTPLogs.
Both Windows and Linux App Services route web server request logs to the AppServiceHTTPLogs category.
4
Construct the JSON array configuration for the --logs parameter.
An array containing enabling objects for AppServiceConsoleLogs and AppServiceHTTPLogs.
The CLI command az monitor diagnostic-settings create expects an array of category enablement objects.

Key Concept

Azure Monitor integration requires selecting correct platform-specific diagnostic log categories (AppServiceConsoleLogs vs AppServiceAppLogs) depending on the underlying operating system of the App Service.
Estimated Time:3m 0s
Rate this question