AzureDiagnostics

存储使用 Azure 诊断模式的 Azure 服务的资源日志。 资源日志描述 Azure 资源的内部操作。

每个 Azure 服务的资源日志具有一组唯一的列。 AzureDiagnostics 表包含 Azure 服务最常用的列。 如果资源日志包含一列,但该列在 AzureDiagnostics 表中尚不存在,则会在第一次收集数据时添加该列。 如果达到 500 列的最大数量,则任何其他列的数据都会添加到动态列中。

使用特定于资源的模式的 Azure 服务将数据存储在特定于该服务的表中,并且不使用 AzureDiagnostics 表。 有关使用每种方法的服务,请参阅下面的 资源类型 。 有关差异的详细信息,请参阅 Azure 资源日志

AdditionalFields 列

与其他表不同, AzureDiagnostics 更容易超过 Log Analytics 工作区中任何表的 500 列限制,因为各种 Azure 资源能够将数据发送到此表。 为了确保没有因活动列数超过此 500 列限制而丢失数据,AzureDiagnostics 列创建将以与其他表不同的方式进行处理。

每个工作区中的 AzureDiagnostics 表将包含至少 相同的 200 列。 对于 2021 年 1 月 19 日之前创建的工作区,该表还将包含在此日期之前已存在的任何列。 将数据发送到尚未就地的列时:

  • 如果当前工作区中 AzureDiagnostics 中的列总数不超过 500,则会像创建任何其他表一样创建一个新列。
  • 如果列总数为或超过 500,则多余的数据将作为属性添加到名为 AdditionalFields 的 动态属性包列中。

示例

为了说明此行为,假设截至 (部署日期) ,我们的工作方案中的 AzureDiagnostics 表如下所示:

列 1 列 2 列 3 ... 列 498
abc def 123 ... 456
... ... ... ... ...

一个资源将数据发送到 AzureDiagnostics ,然后向其数据添加一个新维度,并调用 NewInfo1。 由于表的列数仍少于 500 个,因此首次发生包含此新维度的数据的事件时,将向表添加新列:

列 1 列 2 列 3 ... 列 498 NewInfo1_s
abc def 123 ... 456 xyz
... ... ... ... ... ...

可以在简单的查询中返回此新数据:

AzureDiagnostics | where NewInfo1_s == "xyz"

稍后,另一个资源会将数据发送到 AzureDiagnostics ,该数据添加了名为 NewInfo2NewInfo3 的新维度。 由于此工作区中的表已达到 500 列,因此新数据将进入 AdditionalFields 列:

列 1 列 2 列 3 ... 列 498 NewInfo1_s AdditionalFields
abc def 123 ... 456 xyz {“NewInfo2”:“789”,“NewInfo3”:“qwerty”}
... ... ... ... ... ... ...

仍可查询此数据,但必须使用 KQL 中的任何动态属性运算符从属性包中提取数据:

AzureDiagnostics
| where AdditionalFields.NewInfo2 == "789" and AdditionalFields.NewInfo3 == "qwerty"

有关使用 AdditionalFields 列的提示

尽管应遵循常规查询最佳做法(如始终按时间筛选作为查询中的第一个子句),但在使用 AdditionalFields 时,应考虑其他一些建议:

  • 在对数据执行进一步操作之前,需要键入数据。 例如,如果存在名为 Perf1Sec_i 的列,以及 AdditionalFields 中名为 Perf2Sec 的属性,并且你想要通过添加这两个值来计算总性能,请使用如下所示的内容: AzureDiagnostics | extend TotalPerfSec = Perf1Sec_i + toint(AdditionalFields.Perf2Sec) | ....
  • 在编写任何复杂逻辑以显著提高性能之前,使用 where 子句将数据量减少到尽可能小。 TimeGenerated 是一个列,应始终缩减为尽可能小的窗口。 对于 AzureDiagnostics,还应始终在查询顶部包含一个附加筛选器,围绕使用 ResourceType 列查询的资源类型。
  • 查询大量数据时,有时对 AdditionalFields 作为一个整体执行筛选器,而不是分析它更有效。 例如,对于大量数据, AzureDiagnostics | where AdditionalFields has "Perf2Sec" 通常比 AzureDiagnostics | where isnotnull(toint(AdditionalFields.Perf2Sec))更高效。

Azure 诊断模式

以下服务对其资源日志使用 Azure 诊断 模式,并将数据发送到Azure 诊断表。

  • Analysis Services
  • 应用程序网关
  • 自动化帐户
  • Azure Database for MariaDB 服务器
  • Azure Database for MySQL 服务器
  • Azure Database for PostgreSQL 服务器
  • Azure Database for PostgreSQL 服务器 v2
  • 批处理帐户
  • CDN 配置文件
  • 认知服务
  • Data Lake Analytics
  • DataLake Storage Gen1
  • 设备预配服务
  • 数字孪生
  • 事件网格主题
  • 事件中心
  • ExpressRoute 线路
  • 前门
  • 集成帐户
  • 密钥保管库
  • Kubernetes 服务
  • 负载均衡器
  • 逻辑应用
  • 媒体服务
  • 网络接口
  • 网络安全组
  • P2S VPN 网关
  • Power BI Embedded
  • 公共 IP 地址
  • 恢复服务保管库 (Site Recovery)
  • 搜索服务
  • 服务总线
  • SQL 数据库
  • SQL 托管实例
  • SQL Server
  • 流分析作业
  • 流量管理器配置文件
  • 虚拟网络
  • 虚拟网络网关
  • VPN 网关

Azure 诊断模式或特定于资源的模式

以下服务对其资源日志使用 Azure 诊断 模式或特定于资源的模式,具体取决于其配置。 使用特定于资源的模式时,不会将数据发送到 AzureDiagnostics 表。 有关此配置的详细信息 ,请参阅 Azure 资源日志

  • API 管理 服务
  • Azure Cosmos DB
  • 数据工厂 (V2)
  • IoT 中心
  • 恢复服务保管库 (备份)
  • 防火墙

类别

  • Azure 资源
  • 安全性
  • 网络

解决方案

  • LogManagement

资源类型

  • 应用程序网关
  • CDN 配置文件
  • Azure Cosmos DB
  • 事件网格主题
  • 事件中心
  • 防火墙
  • 密钥保管库
  • Kubernetes 服务
  • 恢复服务保管库
  • 服务总线
  • Azure Database for MySQL 灵活服务器
  • Azure Database for PostgreSQL 灵活服务器
  • 媒体服务
  • Analysis Services
  • Batch 帐户
  • 认知服务
  • 事件网格合作伙伴命名空间
  • 事件网格合作伙伴主题
  • 事件网格系统主题
  • 已启用 Azure Arc 的 Kubernetes
  • Azure Arc 预配群集
  • IoT 中心
  • 逻辑应用
  • API 管理服务
  • 自动化帐户
  • 数据工厂
  • Data Lake Storage Gen1
  • Data Lake Analytics
  • Power BI Embedded
  • SQL 托管实例
  • SQL Server
  • SQL 数据库
  • Azure Database for MySQL 服务器
  • Azure Database for PostgreSQL 服务器
  • Azure Database for PostgreSQL服务器 V2
  • Azure Database for MariaDB 服务器
  • 设备预配服务
  • ExpressRoute 线路
  • 前门
  • 网络接口
  • 网络安全组
  • 公共 IP 地址
  • 流量管理器配置文件
  • 虚拟网络网关
  • 虚拟专用网络网关
  • 虚拟网络
  • 搜索服务
  • 流分析作业

类型 说明
action_id_s 字符串
action_name_s 字符串
action_s 字符串
ActivityId_g Guid
AdditionalFields
AdHocOrScheduledJob_s 字符串
application_name_s 字符串
audit_schema_version_d Double
avg_cpu_percent_s 字符串
avg_mean_time_s 字符串
backendHostname_s 字符串
Caller_s 字符串
callerId_s 字符串
CallerIPAddress 字符串
calls_s 字符串
Category String
client_ip_s 字符串
clientInfo_s 字符串
clientIP_s 字符串
clientIp_s 字符串
clientIpAddress_s 字符串
clientPort_d Double
code_s 字符串
collectionName_s 字符串
conditions_destinationIP_s 字符串
conditions_destinationPortRange_s 字符串
conditions_None_s 字符串
conditions_protocols_s 字符串
conditions_sourceIP_s 字符串
conditions_sourcePortRange_s 字符串
CorrelationId 字符串
count_executions_d Double
cpu_time_d Double
database_name_s 字符串
database_principal_name_s 字符串
DatabaseName_s 字符串
db_id_s 字符串
direction_s 字符串
dop_d Double
duration_d Double
duration_milliseconds_d Double
DurationMs BigInt
ElasticPoolName_s 字符串
endTime_t DateTime
Environment_s 字符串
error_code_s 字符串
error_message_s 字符串
errorLevel_s 字符串
event_class_s 字符串
event_s 字符串
event_subclass_s 字符串
event_time_t DateTime
EventName_s 字符串
execution_type_d Double
executionInfo_endTime_t DateTime
executionInfo_exitCode_d Double
executionInfo_startTime_t DateTime
host_s 字符串
httpMethod_s 字符串
httpStatus_d Double
httpStatusCode_d Double
httpStatusCode_s 字符串
httpVersion_s 字符串
id_s 字符串
identity_claim_appid_g Guid
identity_claim_ipaddr_s 字符串
instanceId_s 字符串
interval_end_time_d Double
interval_start_time_d Double
ip_s 字符串
is_column_permission_s 字符串
isAccessPolicyMatch_b Bool
JobDurationInSecs_s 字符串
JobFailureCode_s 字符串
JobId_g Guid
jobId_s 字符串
JobOperation_s 字符串
JobOperationSubType_s 字符串
JobStartDateTime_s 字符串
JobStatus_s 字符串
JobUniqueId_g Guid
级别 字符串
log_bytes_used_d Double
logical_io_reads_d Double
logical_io_writes_d Double
LogicalServerName_s 字符串
macAddress_s 字符串
matchedConnections_d Double
max_cpu_time_d Double
max_dop_d Double
max_duration_d Double
max_log_bytes_used_d Double
max_logical_io_reads_d Double
max_logical_io_writes_d Double
max_num_physical_io_reads_d Double
max_physical_io_reads_d Double
max_query_max_used_memory_d Double
max_rowcount_d Double
max_time_s 字符串
mean_time_s 字符串
Message String
min_time_s 字符串
msg_s 字符串
num_physical_io_reads_d Double
object_id_d Double
object_name_s 字符串
OperationName String
OperationVersion 字符串
partitionKey_s 字符串
physical_io_reads_d Double
plan_id_d Double
policy_s 字符串
policyMode_s 字符串
primaryIPv4Address_s 字符串
priority_d Double
properties_enabledForDeployment_b Bool
properties_enabledForDiskEncryption_b Bool
properties_enabledForTemplateDeployment_b Bool
properties_s 字符串
properties_sku_Family_s 字符串
properties_sku_Name_s 字符串
properties_tenantId_g Guid
query_hash_s 字符串
query_id_d Double
query_max_used_memory_d Double
query_plan_hash_s 字符串
query_time_d Double
querytext_s 字符串
receivedBytes_d Double
Region_s 字符串
requestCharge_s 字符串
requestQuery_s 字符串
requestResourceId_s 字符串
requestResourceType_s 字符串
requestUri_s 字符串
reserved_storage_mb_s 字符串
资源 String
resource_actionName_s 字符串
resource_location_s 字符串
resource_originRunId_s 字符串
resource_resourceGroupName_s 字符串
resource_runId_s 字符串
resource_subscriptionId_g Guid
resource_triggerName_s 字符串
resource_workflowId_g Guid
resource_workflowName_s 字符串
ResourceGroup String
_ResourceId 字符串 与记录关联的资源的唯一标识符
ResourceProvider String
ResourceProvider String
ResourceType String
ResourceType String
response_rows_d Double
resultCode_s 字符串
ResultDescription 字符串
ResultDescription 字符串
resultDescription_ChildJobs_s 字符串
resultDescription_ErrorJobs_s 字符串
resultMessage_s 字符串
ResultSignature 字符串
ResultType 字符串
ResultType 字符串
rootCauseAnalysis_s 字符串
routingRuleName_s 字符串
rowcount_d Double
ruleName_s 字符串
RunbookName_s 字符串
RunOn_s 字符串
schema_name_s 字符串
sentBytes_d Double
sequence_group_id_g Guid
sequence_number_d Double
server_principal_sid_s 字符串
session_id_d Double