Diagnostic Settings Missing
Use this playbook when the environment is configured for Azure Monitor log routing, but no container app logs arrive in the target Log Analytics workspace.
Symptom
- The environment log destination is
azure-monitor, but Log Analytics queries return no ContainerAppConsoleLogs_CL or ContainerAppSystemLogs_CL rows. - Teams expected Azure Monitor routing to be enough by itself, but downstream workspace ingestion never starts.
- A new environment or app was created successfully and still shows no logs after traffic or restart activity.
Possible Causes
- No diagnostic setting exists on the Container Apps environment resource.
- The diagnostic setting exists, but the wrong categories were enabled.
- Logs are routed to a different workspace than the operator expects.
- Diagnostic settings were added only after the incident and no fresh signal was produced afterward.
- The environment is actually configured for a different log destination.
Diagnosis Steps
flowchart TD
A[Notice empty Log Analytics tables] --> B[Check environment log destination]
B --> C{Destination is azure-monitor?}
C -->|No| D[Use the playbook for the actual destination]
C -->|Yes| E[List diagnostic settings on the environment resource]
E --> F[Confirm workspace resource ID and enabled log categories]
F --> G[Generate a fresh system event]
G --> H{Rows arrive in workspace?}
H -->|Yes| I[Configuration is now complete]
H -->|No| J[Fix diagnostic settings scope or target workspace]
- Verify the environment log destination.
az containerapp env show \
--name "$CONTAINER_ENV" \
--resource-group "$RG" \
--query "properties.appLogsConfiguration.destination" \
--output tsv
- Capture the environment and workspace resource IDs you will use for diagnostic-setting checks.
az containerapp env show \
--name "$CONTAINER_ENV" \
--resource-group "$RG" \
--query "id" \
--output tsv
- List diagnostic settings on the environment resource.
az monitor diagnostic-settings list \
--resource "$ENV_RESOURCE_ID" \
--output json
- Query for recent rows after traffic or a restart event.
let AppName = "ca-myapp";
ContainerAppConsoleLogs_CL
| where ContainerAppName_s == AppName
| where TimeGenerated > ago(30m)
| project TimeGenerated, RevisionName_s, Log_s
| order by TimeGenerated desc
let AppName = "ca-myapp";
ContainerAppSystemLogs_CL
| where ContainerAppName_s == AppName
| where TimeGenerated > ago(30m)
| project TimeGenerated, RevisionName_s, Reason_s, Log_s
| order by TimeGenerated desc
| Command | Why it is used |
az containerapp env show --name "$CONTAINER_ENV" --resource-group "$RG" --query "properties.appLogsConfiguration.destination" --output tsv | Confirms that Azure Monitor routing is actually in use before you troubleshoot diagnostic settings. |
az containerapp env show --name "$CONTAINER_ENV" --resource-group "$RG" --query "id" --output tsv | Retrieves the environment resource ID for scope comparison. |
az monitor diagnostic-settings list --resource "$ENV_RESOURCE_ID" --output json | Shows whether the environment resource has the log-routing diagnostic setting required for Azure Monitor destinations. |
Resolution
- Create or correct the diagnostic setting on the scope your team uses for collection.
az monitor diagnostic-settings create \
--name "aca-observability" \
--resource "$ENV_RESOURCE_ID" \
--workspace "$WORKSPACE_RESOURCE_ID" \
--logs '[{"category":"ContainerAppConsoleLogs","enabled":true},{"category":"ContainerAppSystemLogs","enabled":true}]' \
--metrics '[{"category":"AllMetrics","enabled":true}]'
- Generate a fresh request or revision event after creating the setting, then query the workspace again.
- If you also collect app-level metrics, keep that as a separate metric-only diagnostic setting rather than mixing it with environment log routing.
- Record that environment scope owns log routing so the next incident does not become a scope-discovery exercise.
| Command | Why it is used |
az monitor diagnostic-settings create --name "aca-observability" --resource "$ENV_RESOURCE_ID" --workspace "$WORKSPACE_RESOURCE_ID" --logs ... --metrics ... | Creates the environment-level Azure Monitor routing rule that forwards Container Apps logs and metrics to the target Log Analytics workspace. |
Prevention
- Document that environment scope owns log-routing diagnostic settings when
azure-monitor is the destination. - Keep the workspace resource ID in deployment outputs or operational notes.
- Validate
ContainerAppConsoleLogs and ContainerAppSystemLogs immediately after new environment creation. - Add a post-deployment smoke test that checks for fresh rows in the workspace within an agreed delay window.
See Also
Sources