您现在访问的是微软AZURE全球版技术文档网站,若需要访问由世纪互联运营的MICROSOFT AZURE中国区技术文档网站,请访问 https://docs.azure.cn.

Azure 诊断 1.0 配置架构Azure Diagnostics 1.0 Configuration Schema

备注

Azure 诊断是一个组件,用于从 Azure 虚拟机、虚拟机规模集、Service Fabric 和云服务收集性能计数器和其他统计信息。Azure Diagnostics is the component used to collect performance counters and other statistics from Azure Virtual Machines, Virtual Machine Scale Sets, Service Fabric, and Cloud Services. 在使用以下某个服务时,才需要参阅此页。This page is only relevant if you are using one of these services.

Azure 诊断可以与其他 Microsoft 诊断产品(例如 Azure Monitor、Application Insights 和 Log Analytics)结合使用。Azure Diagnostics is used with other Microsoft diagnostics products like Azure Monitor, Application Insights, and Log Analytics.

Azure 诊断配置文件定义用于初始化诊断监视器的值。The Azure Diagnostics configuration file defines values that are used to initialize the Diagnostics Monitor. 此文件用于在诊断监视器启动时初始化诊断配置设置。This file is used to initialize diagnostic configuration settings when the diagnostics monitor starts.

默认情况下,Azure 诊断配置架构文件将安装到 C:\Program Files\Microsoft SDKs\Azure\.NET SDK\<version>\schemas 目录。By default, the Azure Diagnostics configuration schema file is installed to the C:\Program Files\Microsoft SDKs\Azure\.NET SDK\<version>\schemas directory. <version> 替换为 Azure SDK 的已安装版本。Replace <version> with the installed version of the Azure SDK.

备注

诊断配置文件通常用于启动任务,此类任务需要在启动进程之前收集诊断数据。The diagnostics configuration file is typically used with startup tasks that require diagnostic data to be collected earlier in the startup process. 有关使用 Azure 诊断的详细信息,请参阅使用 Azure 诊断收集日志记录数据For more information about using Azure Diagnostics, see Collect Logging Data by Using Azure Diagnostics.

诊断配置文件示例Example of the diagnostics configuration file

以下示例演示典型的诊断配置文件:The following example shows a typical diagnostics configuration file:

<?xml version="1.0" encoding="utf-8"?>
<DiagnosticMonitorConfiguration xmlns="http://schemas.microsoft.com/ServiceHosting/2010/10/DiagnosticsConfiguration"  
      configurationChangePollInterval="PT1M"  
      overallQuotaInMB="4096">  
   <DiagnosticInfrastructureLogs bufferQuotaInMB="1024"  
      scheduledTransferLogLevelFilter="Verbose"  
      scheduledTransferPeriod="PT1M" />  
   <Logs bufferQuotaInMB="1024"  
      scheduledTransferLogLevelFilter="Verbose"  
      scheduledTransferPeriod="PT1M" />  

   <Directories bufferQuotaInMB="1024"   
      scheduledTransferPeriod="PT1M">  

      <!-- These three elements specify the special directories   
           that are set up for the log types -->  
      <CrashDumps container="wad-crash-dumps" directoryQuotaInMB="256" />  
      <FailedRequestLogs container="wad-frq" directoryQuotaInMB="256" />  
      <IISLogs container="wad-iis" directoryQuotaInMB="256" />  

      <!-- For regular directories the DataSources element is used -->  
      <DataSources>  
         <DirectoryConfiguration container="wad-panther" directoryQuotaInMB="128">  
            <!-- Absolute specifies an absolute path with optional environment expansion -->  
            <Absolute expandEnvironment="true" path="%SystemRoot%\system32\sysprep\Panther" />  
         </DirectoryConfiguration>  
         <DirectoryConfiguration container="wad-custom" directoryQuotaInMB="128">  
            <!-- LocalResource specifies a path relative to a local   
                 resource defined in the service definition -->  
            <LocalResource name="MyLoggingLocalResource" relativePath="logs" />  
         </DirectoryConfiguration>  
      </DataSources>  
   </Directories>  

   <PerformanceCounters bufferQuotaInMB="512" scheduledTransferPeriod="PT1M">  
      <!-- The counter specifier is in the same format as the imperative   
           diagnostics configuration API -->  
      <PerformanceCounterConfiguration   
         counterSpecifier="\Processor(_Total)\% Processor Time" sampleRate="PT5S" />  
   </PerformanceCounters>  

   <WindowsEventLog bufferQuotaInMB="512"  
      scheduledTransferLogLevelFilter="Verbose"  
      scheduledTransferPeriod="PT1M">  
      <!-- The event log name is in the same format as the imperative   
           diagnostics configuration API -->  
      <DataSource name="System!*" />  
   </WindowsEventLog>  
</DiagnosticMonitorConfiguration>  

DiagnosticsConfiguration 命名空间DiagnosticsConfiguration Namespace

诊断配置文件的 XML 命名空间是:The XML namespace for the diagnostics configuration file is:

http://schemas.microsoft.com/ServiceHosting/2010/10/DiagnosticsConfiguration  

架构元素Schema Elements

诊断配置文件包括以下元素。The diagnostics configuration file includes the following elements.

DiagnosticMonitorConfiguration 元素DiagnosticMonitorConfiguration Element

诊断配置文件的顶级元素。The top-level element of the diagnostics configuration file.

属性:Attributes:

属性Attribute 类型Type 必选Required 默认Default 说明Description
configurationChangePollIntervalconfigurationChangePollInterval durationduration 可选Optional PT1MPT1M 指定诊断监视器轮询诊断配置更改的时间间隔。Specifies the interval at which the diagnostic monitor polls for diagnostic configuration changes.
overallQuotaInMBoverallQuotaInMB unsignedIntunsignedInt 可选Optional 4000 MB。4000 MB. 提供的值不得超过此值If you provide a value, it must not exceed this amount 为所有日志记录缓冲区分配的文件系统存储的总量。The total amount of file system storage allocated for all logging buffers.

DiagnosticInfrastructureLogs 元素DiagnosticInfrastructureLogs Element

定义由基础诊断基础结构生成的日志的缓冲区配置。Defines the buffer configuration for the logs that are generated by the underlying diagnostics infrastructure.

父元素:DiagnosticMonitorConfiguration 元素Parent Element: DiagnosticMonitorConfiguration Element.

属性:Attributes:

属性Attribute 类型Type 说明Description
bufferQuotaInMBbufferQuotaInMB unsignedIntunsignedInt 可选。Optional. 指定可用于存储指定数据的文件系统存储最大容量。Specifies the maximum amount of file system storage that is available for the specified data.

默认值为 0。The default is 0.
scheduledTransferLogLevelFilterscheduledTransferLogLevelFilter 字符串string 可选。Optional. 指定传输的日志条目的最低严重级别。Specifies the minimum severity level for log entries that are transferred. 默认值为“未定义”。The default value is Undefined. 其他可能的值为“详细”、“信息”、“警告”、“错误”和“严重”。Other possible values are Verbose, Information, Warning, Error, and Critical.
scheduledTransferPeriodscheduledTransferPeriod durationduration 可选。Optional. 指定计划的数据传输之间的时间间隔,向上舍入为最接近的分钟数。Specifies the interval between scheduled transfers of data, rounded up to the nearest minute.

默认是 PT0S。The default is PT0S.

Logs 元素Logs Element

定义基本 Azure 日志的缓冲区配置。Defines the buffer configuration for basic Azure logs.

父元素:DiagnosticMonitorConfiguration 元素Parent element: DiagnosticMonitorConfiguration Element.

属性:Attributes:

属性Attribute 类型Type 说明Description
bufferQuotaInMBbufferQuotaInMB unsignedIntunsignedInt 可选。Optional. 指定可用于存储指定数据的文件系统存储最大容量。Specifies the maximum amount of file system storage that is available for the specified data.

默认值为 0。The default is 0.
scheduledTransferLogLevelFilterscheduledTransferLogLevelFilter 字符串string 可选。Optional. 指定传输的日志条目的最低严重级别。Specifies the minimum severity level for log entries that are transferred. 默认值为“未定义”。The default value is Undefined. 其他可能的值为“详细”、“信息”、“警告”、“错误”和“严重”。Other possible values are Verbose, Information, Warning, Error, and Critical.
scheduledTransferPeriodscheduledTransferPeriod durationduration 可选。Optional. 指定计划的数据传输之间的时间间隔,向上舍入为最接近的分钟数。Specifies the interval between scheduled transfers of data, rounded up to the nearest minute.

默认是 PT0S。The default is PT0S.

Directories 元素Directories Element

为可以定义的基于文件的日志定义缓冲区配置。Defines the buffer configuration for file-based logs that you can define.

父元素:DiagnosticMonitorConfiguration 元素Parent element: DiagnosticMonitorConfiguration Element.

属性:Attributes:

属性Attribute 类型Type 说明Description
bufferQuotaInMBbufferQuotaInMB unsignedIntunsignedInt 可选。Optional. 指定可用于存储指定数据的文件系统存储最大容量。Specifies the maximum amount of file system storage that is available for the specified data.

默认值为 0。The default is 0.
scheduledTransferPeriodscheduledTransferPeriod durationduration 可选。Optional. 指定计划的数据传输之间的时间间隔,向上舍入为最接近的分钟数。Specifies the interval between scheduled transfers of data, rounded up to the nearest minute.

默认是 PT0S。The default is PT0S.

CrashDumps 元素CrashDumps Element

定义故障转储目录。Defines the crash dumps directory.

父元素:Directories 元素Parent Element: Directories Element.

属性:Attributes:

属性Attribute 类型Type 说明Description
容器container 字符串string 容器的名称,将要传输容器中的目录内容。The name of the container where the contents of the directory is to be transferred.
directoryQuotaInMBdirectoryQuotaInMB unsignedIntunsignedInt 可选。Optional. 指定目录的大小上限(以兆字节为单位)。Specifies the maximum size of the directory in megabytes.

默认值为 0。The default is 0.

FailedRequestLogs 元素FailedRequestLogs Element

定义失败的请求日志目录。Defines the failed request log directory.

父元素:Directories 元素Parent Element Directories Element.

属性:Attributes:

属性Attribute 类型Type 说明Description
容器container 字符串string 容器的名称,将要传输容器中的目录内容。The name of the container where the contents of the directory is to be transferred.
directoryQuotaInMBdirectoryQuotaInMB unsignedIntunsignedInt 可选。Optional. 指定目录的大小上限(以兆字节为单位)。Specifies the maximum size of the directory in megabytes.

默认值为 0。The default is 0.

IISLogs 元素IISLogs Element

定义 IIS 日志目录。Defines the IIS log directory.

父元素:Directories 元素Parent Element Directories Element.

属性:Attributes:

属性Attribute 类型Type 说明Description
容器container 字符串string 容器的名称,将要传输容器中的目录内容。The name of the container where the contents of the directory is to be transferred.
directoryQuotaInMBdirectoryQuotaInMB unsignedIntunsignedInt 可选。Optional. 指定目录的大小上限(以兆字节为单位)。Specifies the maximum size of the directory in megabytes.

默认值为 0。The default is 0.

DataSources 元素DataSources Element

定义零个或多个其他日志目录。Defines zero or more additional log directories.

父元素:Directories 元素Parent Element: Directories Element.

DirectoryConfiguration 元素DirectoryConfiguration Element

定义要监视的日志文件的目录。Defines the directory of log files to monitor.

父元素:DataSources 元素Parent Element: DataSources Element.

属性:Attributes:

属性Attribute 类型Type 说明Description
容器container 字符串string 容器的名称,将要传输容器中的目录内容。The name of the container where the contents of the directory is to be transferred.
directoryQuotaInMBdirectoryQuotaInMB unsignedIntunsignedInt 可选。Optional. 指定目录的大小上限(以兆字节为单位)。Specifies the maximum size of the directory in megabytes.

默认值为 0。The default is 0.

Absolute 元素Absolute Element

定义要使用可选环境扩展监视的目录的绝对路径。Defines an absolute path of the directory to monitor with optional environment expansion.

父元素:DirectoryConfiguration 元素Parent Element: DirectoryConfiguration Element.

属性:Attributes:

属性Attribute 类型Type 说明Description
路径path 字符串string 必需。Required. 要监视的目录的绝对路径。The absolute path to the directory to monitor.
expandEnvironmentexpandEnvironment 布尔值boolean 必需。Required. 如果设置为 true,则扩展路径中的环境变量。If set to true, environment variables in the path are expanded.

LocalResource 元素LocalResource Element

定义服务定义中定义的本地资源的相对路径。Defines a path relative to a local resource defined in the service definition.

父元素:DirectoryConfiguration 元素Parent Element: DirectoryConfiguration Element.

属性:Attributes:

属性Attribute 类型Type 说明Description
namename 字符串string 必需。Required. 包含要监视的目录的本地资源的名称。The name of the local resource that contains the directory to monitor.
relativePathrelativePath 字符串string 必需。Required. 相对于要监视的本地资源的路径。The path relative to the local resource to monitor.

PerformanceCounters 元素PerformanceCounters Element

定义要收集的性能计数器的路径。Defines the path to the performance counter to collect.

父元素:DiagnosticMonitorConfiguration 元素Parent Element: DiagnosticMonitorConfiguration Element.

属性:Attributes:

属性Attribute 类型Type 说明Description
bufferQuotaInMBbufferQuotaInMB unsignedIntunsignedInt 可选。Optional. 指定可用于存储指定数据的文件系统存储最大容量。Specifies the maximum amount of file system storage that is available for the specified data.

默认值为 0。The default is 0.
scheduledTransferPeriodscheduledTransferPeriod durationduration 可选。Optional. 指定计划的数据传输之间的时间间隔,向上舍入为最接近的分钟数。Specifies the interval between scheduled transfers of data, rounded up to the nearest minute.

默认是 PT0S。The default is PT0S.

PerformanceCounterConfiguration 元素PerformanceCounterConfiguration Element

定义要收集的性能计数器。Defines the performance counter to collect.

父元素:PerformanceCounters 元素Parent Element: PerformanceCounters Element.

属性:Attributes:

属性Attribute 类型Type 说明Description
counterSpecifiercounterSpecifier 字符串string 必需。Required. 要收集的性能计数器的路径。The path to the performance counter to collect.
sampleRatesampleRate durationduration 必需。Required. 应收集性能计数器的速率。The rate at which the performance counter should be collected.

WindowsEventLog 元素WindowsEventLog Element

定义要监视的事件日志。Defines the event logs to monitor.

父元素:DiagnosticMonitorConfiguration 元素Parent Element: DiagnosticMonitorConfiguration Element.

属性:Attributes:

属性Attribute 类型Type 说明Description
bufferQuotaInMBbufferQuotaInMB unsignedIntunsignedInt 可选。Optional. 指定可用于存储指定数据的文件系统存储最大容量。Specifies the maximum amount of file system storage that is available for the specified data.

默认值为 0。The default is 0.
scheduledTransferLogLevelFilterscheduledTransferLogLevelFilter 字符串string 可选。Optional. 指定传输的日志条目的最低严重级别。Specifies the minimum severity level for log entries that are transferred. 默认值为“未定义”。The default value is Undefined. 其他可能的值为“详细”、“信息”、“警告”、“错误”和“严重”。Other possible values are Verbose, Information, Warning, Error, and Critical.
scheduledTransferPeriodscheduledTransferPeriod durationduration 可选。Optional. 指定计划的数据传输之间的时间间隔,向上舍入为最接近的分钟数。Specifies the interval between scheduled transfers of data, rounded up to the nearest minute.

默认是 PT0S。The default is PT0S.

DataSource 元素DataSource Element

定义要监视的事件日志。Defines the event log to monitor.

父元素:WindowsEventLog 元素Parent Element: WindowsEventLog Element.

属性:Attributes:

属性Attribute 类型Type 说明Description
namename 字符串string 必需。Required. 指定要收集的日志的 XPath 表达式。An XPath expression specifying the log to collect.