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?
- [{"category": "AppServiceConsoleLogs", "enabled": true}, {"category": "AppServiceHTTPLogs", "enabled": true}]Answer
- B[{"category": "AppServiceAppLogs", "enabled": true}, {"category": "AppServiceHTTPLogs", "enabled": true}]
- C[{"category": "AppServiceConsoleLogs", "enabled": true}, {"category": "AppServicePlatformLogs", "enabled": true}]
- 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
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