如何使用 Azure 资源管理器在 Azure Web 应用程序中设置应用程序日志

Ash*_*ham 2 powershell json azure azure-resource-manager

有谁知道如何使用 Azure 资源管理器(Powershell 或 JSON)在 Azure Web 应用程序上设置以下诊断设置。

在此处输入图片说明

使用 .json 我只能找到这些设置

     "requestTracingEnabled": true, /* Failed request tracing, aka 'freb' */
     "httpLoggingEnabled": true, /* IIS logs (aka Web server logging) */
     "logsDirectorySizeLimit": 40, /* 40 MB limit for IIS logs */
     "detailedErrorLoggingEnabled": true, /* Detailed error messages  */
Run Code Online (Sandbox Code Playgroud)

这会打开 Web 服务器日志记录到文件系统,而不是应用程序日志记录或 Blob 存储。

使用 Powershell,此命令似乎仅适用于 ASM,因为它找不到提供给它的非经典存储帐户

   Enable-AzureWebsiteApplicationDiagnostic
Run Code Online (Sandbox Code Playgroud)

任何帮助,将不胜感激。我们目前使用的是 Azure Powershell 0.9.8

问候

juv*_*han 6

Azure Resource Manager (ARM) template json配置基于你的屏幕截图应用程序日志(BLOB)和Web服务器日志记录(存储)以上如下图所示部分:

{
  "apiVersion": "2015-08-01",
  "name": "logs",
  "type": "config",
  "dependsOn": [
    "[resourceId('Microsoft.Web/Sites', parameters('siteName'))]"
  ],
  "properties": {
    "applicationLogs": {
      "azureBlobStorage": {
        "level": "Information",
        "sasUrl": "<Your Azure Blob Storage Account SAS Url>",
        "retentionInDays": null
      }
    },
    "httpLogs": {
      "azureBlobStorage": {
        "sasUrl": "<Your Azure Blob Storage Account SAS Url>",
        "retentionInDays": null,
        "enabled": true
      }
    },
    "failedRequestsTracing": {
      "enabled": true
    },
    "detailedErrorMessages": {
      "enabled": true
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

参考:AzureWebsitesSamples/ARMTemplates/WebAppManyFeatures.json

希望这能回答您的问题并帮助解决您的问题。

如果您需要进一步的帮助或说明,请告诉我。