Hi Van Huy Tuyen,
Looks like you're dealing with some log issues when sending data from your Azure Container Apps environment to a Log Analytics workspace. It worked at first, but now nothing’s showing up frustrating, Let’s troubleshoot this step by step:
This is the expected setup:
- Make sure everything is properly configured in Azure Monitor Private Link Scopes. Sometimes, it’s easy to miss a step when connecting to the Log Analytics workspace.
- Head to the portal and confirm your Container Apps environment is still hooked up to the Private Link Scope. There could be a hiccup there.
- Make sure the private endpoint tied to the scope is active and set up correctly. DNS settings, NSGs (network security groups), or route tables might be blocking things—worth a look.
- Check out the logs and see if there are any error messages. Also, verify that permissions are all good on the resources you're using.
- If none of this works, try removing and re-adding the connections between the environment, Private Link Scope, and Log Analytics workspace. Sometimes a clean slate fixes things.
Finally to ensure the setup works, you can test sending a log message from within the VNet to the Log Analytics workspace using Azure CLI:
# Replace these values with your own
WORKSPACE_ID="<Your-Log-Analytics-Workspace-ID>"
SHARED_KEY="<Your-Shared-Key>"
LOG_TYPE="NetworkTestLog"
MESSAGE="Testing log message through VNet."
# Create a JSON payload
JSON_PAYLOAD=$(jq -n --arg message "$MESSAGE" '[{"message": $message}]')
# Generate the authorization signature
DATE=$(date -u +"%a, %d %b %Y %H:%M:%S GMT")
STRING_TO_HASH="POST\n$(echo -n $JSON_PAYLOAD | wc -c)\napplication/json\nx-ms-date:$DATE\n/api/logs"
SIGNATURE=$(echo -en $STRING_TO_HASH | openssl dgst -sha256 -hmac "$SHARED_KEY" -binary | base64)
# Submit the log via HTTPS
curl -X POST \
-d "$JSON_PAYLOAD" \
-H "Content-Type: application/json" \
-H "Log-Type: $LOG_TYPE" \
-H "x-ms-date: $DATE" \
-H "Authorization: SharedKey $WORKSPACE_ID:$SIGNATURE" \
"https://$WORKSPACE_ID.ods.opinsights.azure.com/api/logs?api-version=2016-04-01"
Refences:
- https://learn.microsoft.com/en-us/azure/azure-monitor/logs/private-link-configure
- https://learn.microsoft.com/en-us/azure/container-apps/log-monitoring
If the information helped address your question, please Accept the answer.
Luis