Soru

Zorluk: OrtaDiagnose and Log App Service Web Apps

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?

  1. 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 filesystemCevap
  2. B
    Add an Application Insights instrumentation key to the App Service configurations, as built-in Log Stream requires Application Insights telemetry to be enabled first
  3. C
    Configure 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
  4. D
    Scale the App Service plan from the Basic tier to the Premium v3 tier, as container log streaming is disabled on the Basic tier

Cevap

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.

Adım Adım Çözüm

1
Identify why the log tail output is empty on the Linux-based App Service.
By default, Docker container stdout and stderr logging are disabled on Linux-based Azure App Services, which prevents log streaming from displaying any startup output.
Understanding the default logging state of Linux App Services is key to troubleshooting empty log streams.
2
Select the correct Azure CLI command to configure Docker container logging.
The command 'az webapp log config' with the '--docker-container-logging filesystem' parameter must be used.
This parameter configures the App Service host to write container output streams to the filesystem so they can be captured by the streaming engine.
3
Run the log streaming command to capture the active log stream.
Executing 'az webapp log tail' displays the live logs as the container attempts to start.
Once logging is enabled, the tail command can successfully attach to the active log file stream.

Anahtar Kavram

Enabling Docker container logging to filesystem for Linux Azure App Services to stream container logs via CLI.
Bu soruyu puanla