简体   繁体   English

在 Azure WebApp 部署中设置应用服务日志的保留期

[英]Set Retention Period for App Service logs in Azure WebApp Deployment

I am deploying a Azure WebService (Linux Container) with az CLI and Biceps files.我正在使用 az CLI 和 Biceps 文件部署 Azure WebService(Linux 容器)。 Below is an excerpt from my logging configuration.以下是我的日志记录配置的摘录。

resource appConfigLogs 'Microsoft.Web/sites/config@2021-02-01' = {
  name: 'logs'
  parent: app
  properties: {
    detailedErrorMessages: {
      enabled: true
    }
    failedRequestsTracing: {
      enabled: true
    }
    httpLogs: {
      fileSystem: {
        enabled: true
        retentionInDays: 7
        retentionInMb: 50
      }
    }
  }
}

To my understanding the setting "retentionInDays" corresponds to "Retention Period (Days)" which can be found in the Azure Portal in the WebApp Resource > "Monitoring" > "App Service logs".据我了解,设置“retentionInDays”对应于“保留期(天)”,可以在 Azure 门户的 WebApp 资源 >“监控”>“应用服务日志”中找到。

When setting via Portal, the App Services Configuration gets updated with an Application setting called "WEBSEITE_HTTPLOGGING_RETENTION_DAYS" set to the respective value.通过门户进行设置时,应用服务配置会使用名为“WEBSEITE_HTTPLOGGING_RETENTION_DAYS”的应用程序设置进行更新,并将其设置为相应的值。

When setting via ARM Deplyment (see Biceps above), there is no Configuration value set.当通过 ARM Deplyment(参见上面的二头肌)进行设置时,没有设置配置值。 Is this a bug or do these two settings "retentionInDays" / "Retention Period (Days)" simply not correlate with each other?这是一个错误还是这两个设置“retentionInDays”/“保留期(天)”根本不相关?

When setting via ARM Deployment (see Biceps above), there is no Configuration value set.通过 ARM 部署(参见上面的二头肌)进行设置时,没有设置配置值。 Is this a bug or do these two settings "retentionInDays" / "Retention Period (Days)" simply not correlate with each other?这是一个错误还是这两个设置“retentionInDays”/“保留期(天)”根本不相关?

This is not a bug."retentionInDays" / "Retention Period (Days)" are not two individual settings.这不是错误。“retentionInDays”/“保留期(天)”不是两个单独的设置。 In ARM template configuration in order to use retention period to store logs for a period of time we use this parameter retentionInDays same parameter will be displayed in the portal as RententionPeriod(Days)在 ARM 模板配置中为了使用保留期来存储一段时间的日志,我们使用此参数retentionInDays相同的参数将在门户中显示为RententionPeriod(Days)

We have written an ARM template & tested in our local environment which is working fine.This template will create web app, storage account, enabling app service logs & the application setting WEBSEITE_HTTPLOGGING_RETENTION_DAYS as well as shown below.我们编写了一个 ARM 模板并在我们的本地环境中进行了测试,效果很好。该模板将创建 web 应用程序、存储帐户、启用应用程序服务日志和应用程序设置WEBSEITE_HTTPLOGGING_RETENTION_DAYS以及如下所示。

在此处输入图像描述

You can refer this blogpost for more information about configuring app server logs to a storage account using ARM template.您可以参考这篇博文,了解有关使用 ARM 模板将应用服务器日志配置到存储帐户的更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM