Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Configure Azure Container Apps environment monitoring

Point in time info of your application is nice, however, it is also beneficial to have overall monitoring data available. For this you can enable logs on your Azure Container Apps environment. Container Apps application logs consist of two different categories:

  • Container console output (stdout/stderr) messages.
  • System logs generated by Azure Container Apps.
  • Spring App console logs.

Enable logging on your Azure Container Apps environment. You can follow the below guidance to do so.

Step by step guidance

  1. In your bash shell, create a Log Analytics workspace.

    WORKSPACE=la-$APPNAME-$UNIQUEID
    az monitor log-analytics workspace create \
        --resource-group $RESOURCE_GROUP \
        --workspace-name $WORKSPACE   
    
  2. Enable logging on your Azure Container Apps environment.

    WORKSPACECID=$(az monitor log-analytics workspace show -n $WORKSPACE -g $RESOURCE_GROUP --query customerId -o tsv)
    
    WORKSPACEKEY=$(az monitor log-analytics workspace get-shared-keys -n $WORKSPACE -g $RESOURCE_GROUP --query primarySharedKey -o tsv)
    
    az containerapp env update \
        --name $ACA_ENVIRONMENT \
        --resource-group $RESOURCE_GROUP \
        --logs-destination log-analytics \
        --logs-workspace-id $WORKSPACECID \
        --logs-workspace-key $WORKSPACEKEY   
    
  3. To verify that monitoring data is available in your Log Analytics workspace, in your browser, navigate to your ACA instance in the Azure Portal. Under Monitoring, select Logs. You can inspect here the monitoring data in your app. If you double click ContainerAppConsoleLogs_CL and press Run it will show you the data in this log table.

    logs