A developer is troubleshooting an application startup issue on a Linux-based Azure App Service named finance-app in the resource group finance-rg. The container starts but immediately exits. The developer wants to view the startup logs in real-time from the Azure CLI. They execute the command: az webapp log tail --name finance-app --resource-group finance-rg. However, the command output remains empty and does not display any container startup messages. What must the developer do first to resolve this issue and view the startup logs?
- Enable Docker container logging to the filesystem by running the command: az webapp log config --name finance-app --resource-group finance-rg --docker-container-logging filesystemAnswer
- BAdd an Application Insights instrumentation key to the App Service configurations, as built-in Log Stream requires Application Insights telemetry to be enabled first
- CConfigure an Azure Key Vault access policy that grants the App Service's managed identity the Get permission for secrets, as log streaming credentials are secured in Key Vault by default
- DScale the App Service plan from the Basic tier to the Premium v3 tier, as container log streaming is disabled on the Basic tier
Answer
Enable Docker container logging to the filesystem by running the command: az webapp log config --name finance-app --resource-group finance-rg --docker-container-logging filesystem
On a Linux-based Azure App Service, application logs (STDOUT/STDERR) are captured via Docker container logging. This is disabled by default. Running 'az webapp log config' with '--docker-container-logging filesystem' enables the collection of these logs to the local filesystem, which allows the 'az webapp log tail' command to successfully stream the log output in real-time.
Step-by-Step Solution
Key Concept
Enabling Docker container logging to filesystem for Linux Azure App Services to stream container logs via CLI.