Azure / Azure/azure-quickstart-templates

Web app diagnostics logs not written to blob container

Open
#5,461 6 comments 2 reactions 0 assignees View on GitHub
Dominant language
Bicep
Stars
14.9k
Forks
16.2k
Avg merge
6d 21h
Merged PRs (30d)
6

Description

[301-web-app-diagnostics-logs-blob-container](https://github.com/Azure/azure-quickstart-templates/tree/master/301-web-app-diagnostics-logs-blob-container)

### Issue Details
There are no issues deploying the arm template and the 'App Service/Diagnostic Logs' seems to be configured as expected with the 'Application Logging (Blob)' as 'On' state and using the '\(\)' StorageSettings.
The problem is that under the created container the 'expected' structure with the webapp name is not created neither logs are being stored... It's just empty.

The 'App Service/Application settings/Application settings/DIAGNOSTICS_AZUREBLOBCONTAINERSASURL' value seems to have a valid Account SAS token https://.blob.core.windows.net/?sv=2015-04-05&ss=bfqt&srt=sco&sp=rwdlacup&st=2018-10-01T00:00:00.0000000Z&se=2218-10-30T00:00:00.0000000Z&sig=

> Creating the storage account manually and assigning a new container during the webapp diagnostic config works as expected, but SAS token structure is different:
> https://.blob.core.windows.net/?sv=2017-04-17&sr=c&sig=&st=2018-12-27T13:42:25Z&se=2218-12-27T13:42:25Z&sp=rwdl

I've tried to create a service SAS token as above at the arm template using below code but also fails not creating the expected logs structure under the container
```
"variables": [
"applogsServiceSasFunctionValues": {
"canonicalizedResource": "[concat('/blob/', parameters('diagnosticsStorageAccountName'), '/appservice-applogs')]",
"signedPermission": "rwdl",
"signedStart": "2018-12-27T00:00:00Z",
"signedExpiry": "2218-12-27T00:00:00Z",
"signedResource": "c"
}
]
```

```
{
"condition": "[not(empty(variables('diagnosticsStorageAccountName')))]",
"type": "Microsoft.Web/sites/config",
"apiVersion": "2018-02-01",
"name": "[concat(parameters('siteName'), '/logs')]",
"dependsOn": [
"[parameters('siteName')]",
"[variables('diagnosticsStorageAccountName')]"
],
"properties": {
"applicationLogs": {
"azureBlobStorage": {
"level": "[variables('diagnosticsLogsLevel')]",
"sasUrl": "[if(not(empty(variables('diagnosticsStorageAccountName'))),concat(reference(concat('Microsoft.Storage/storageAccounts/', parameters('diagnosticsStorageAccountName')), '2016-01-01').primaryEndpoints.blob, 'appservice-webserverlogs', '?', listServiceSas(resourceId('Microsoft.Storage/storageAccounts', variables('diagnosticsStorageAccountName')), '2018-02-01', variables('applogsServiceSasFunctionValues')).serviceSasToken),json('null'))]",
"retentionInDays": "[variables('diagnosticsLogsRetentionInDays')]"
}
},
```

### Repro steps
1. Deploy arm template [301-web-app-diagnostics-logs-blob-container](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-quickstart-templates%2Fmaster%2F301-web-app-diagnostics-logs-blob-container%2Fazuredeploy.json)
2. Navigate to the storage account created and explore the container. It should contains a '\' sub container on it, but it's empty

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with 301-web-app-diagnostics-logs-blob-container/azuredeploy.json and inspect the Microsoft.Web/sites/config logs resource, its SAS URL construction, and the storage account dependency. Reproduce the deployment from the linked template, then verify that the created blob container contains the expected app-service subcontainer and logs.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure
Domain
cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.