儲存使用了 Azure 診斷模式的 Azure 服務資源記錄。 資源記錄會描述 Azure 資源的內部作業。
每個 Azure 服務的資源記錄都有一組獨特的資料行。 AzureDiagnostics 資料表包含 Azure 服務最常使用的資料行。 如果資源記錄包含尚不存在於 AzureDiagnostics 資料表中的資料行,則會在第一次收集資料時新增該資料行。 如果達到數目上限 500 個資料行,則會將任何額外資料行的資料新增至動態資料行。
使用資源特定模式的 Azure 服務會將數據儲存在該服務特定的數據表中,且不會使用 AzureDiagnostics 數據表。 如需差異的詳細資訊,請參閱 Azure 資源 記錄。 如需使用 Azure 診斷 的服務,請參閱使用 Azure 診斷 模式的資源。
附註
AzureDiagnostics 數據表是 Azure 監視器管線第一次開始以 Azure 診斷 模式傳送記錄時,由 Azure 監視器管線獨佔建立的自定義記錄數據表。 不同於其他數據表,無法透過ARM樣本或資料表 API 建立 AzureDiagnostics 資料表。 因此,在建立數據表之前,無法修改數據表的預設保留值。
AdditionalFields 資料行
與其他資料表不同,AzureDiagnostics 更容易超過 Log Analytics 工作區中針對任何資料表強制的 500 個資料行限制,因為能夠將資料傳送至此資料表的各種 Azure 資源。 為了確保不會由於作用中資料行數目超過此 500 個資料行限制而遺失任何資料,AzureDiagnostics 資料行建立會以與其他資料表不同的方式處理。
每個工作區中的 AzureDiagnostics 數據表至少包含相同的 200 個數據行。 對於在 2021 年 1 月 19 日之前建立的工作區,數據表也包含此日期之前已就緒的任何數據行。 當資料傳送到尚未存在的資料行時:
- 如果目前工作區中 AzureDiagnostics 表的欄總數不超過 500,則會建立新的欄,就像使用任何其他數據表一樣。
- 如果數據行總數在 500 以上,則多餘的數據會新增至稱為 AdditionalFields 的動態屬性包數據行作為屬性。
範例
為了說明此行為,假設從 (部署日期) 開始,我們的工作區中的 AzureDiagnostics 數據表看起來如下所示:
欄 1 | Column 2 | 欄 3 | ... | Column 498 |
---|---|---|---|---|
abc | def | 123 | ... | 456 |
... | ... | ... | ... | ... |
將數據傳送至 AzureDiagnostics 的資源,然後在其數據中新增一個新維度,稱之為 NewInfo1。 由於數據表仍然少於 500 個數據行,因此第一次發生事件時,包含這個新維度的數據會將新的數據行新增至數據表:
欄 1 | Column 2 | 欄 3 | ... | 第498欄 | NewInfo1_s |
---|---|---|---|---|---|
abc | def | 123 | ... | 456 | xyz |
... | ... | ... | ... | ... | ... |
您可以在簡單的查詢中傳回這個新資料:
AzureDiagnostics | where NewInfo1_s == "xyz"
在稍後的日期,另一個資源會將數據傳送至 AzureDiagnostics ,以新增名為 NewInfo2 和 NewInfo3 的新維度。 由於此工作區中的數據表已達 500 個數據行,因此新的數據會進入 AdditionalFields 數據行:
欄 1 | Column 2 | 欄 3 | ... | Column 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 診斷 數據表。 如需此設定的詳細資訊,請參閱 Azure 資源記錄 。
附註
所有其他資源都會將數據傳送至資源特定的數據表。
服務名稱 | 資源類型 |
---|---|
MicrosoftSqlAzureTelemetryv3 | microsoft.sql/伺服器/資料庫 |
MicrosoftAzureCosmosDB | microsoft.documentdb/databaseaccounts |
Azure 防火牆 | microsoft.network/azurefirewalls |
Azure應用程式閘道服務 (AzureApplicationGatewayService) | microsoft.network/applicationgateways |
AKSCustomerData | microsoft.containerservice/managedclusters |
AzureFrontdoor | microsoft.cdn/profiles |
LNMAgentService | microsoft.network/networksecuritygroups |
MicrosoftOrcasBreadthServers | microsoft.dbforpostgresql/flexibleservers |
servicebus | microsoft.eventhub/namespaces |
AzureFrontdoor | microsoft.network/frontdoors |
AzureKeyVault | microsoft.keyvault/vaults |
AzureDataLake | microsoft.datalakestore/accounts |
ApiManagement | microsoft.apimanagement/service |
MicrosoftSqlAzureTelemetryv3 | microsoft.sql/managedinstances |
ASAzureRP | microsoft.analysisservices/servers |
MicrosoftOrcasBreadthServers | microsoft.dbformysql/flexibleservers |
servicebus | microsoft.servicebus/namespaces |
AzureIotHub | microsoft.devices/iothubs |
MicrosoftSqlAzureTelemetryv2 | microsoft.dbforpostgresql/servers |
MicrosoftSqlAzureTelemetryv2 | microsoft.dbformariadb/servers |
微軟自動化 | microsoft.automation/automationaccounts |
TrafficManager | microsoft.network/trafficmanagerprofiles |
MicrosoftOrcasBreadthServers | microsoft.dbforpostgresql/servergroupsv2 |
AzureSearch | microsoft.search/searchservices |
AzureHybrid | microsoft.network/virtualnetworkgateways |
MicrosoftSqlAzureTelemetryv3 | microsoft.sql/managedinstances/databases |
PBIDedicatedRP | microsoft.powerbidedicated/capacities |
AzureHybrid | microsoft.network/vpngateways |
MicrosoftDatafactory | microsoft.datafactory/factories |
MicrosoftCognitiveServices | microsoft.cognitiveservices/accounts |
AzureRecoveryServices | microsoft.recoveryservices/vaults |
AzureBatch | microsoft.batch/batchaccounts |
AzureHybrid | microsoft.network/p2svpngateways |
MicrosoftSqlAzureTelemetryv2 | microsoft.dbformysql/servers |
AzureKeyVault | microsoft.keyvault/managedhsms |
NetMon | microsoft.network/publicipaddresses |
AzureDataLake | microsoft.datalakeanalytics/accounts |
MicrosoftStreamanalytics | microsoft.streamanalytics/streamingjobs |
servicebus | microsoft.relay/namespaces |
AzureIotDps | microsoft.devices/provisioningservices |
MicrosoftAzureCosmosDB | microsoft.documentdb/cassandraclusters |
MicrosoftAzureCosmosDB | microsoft.documentdb/mongoclusters |
AKSCustomerData | microsoft.containerservice/fleets |
PBIDedicatedRP | microsoft.powerbi/tenants/workspaces |
Azure Front Door(Azure 前端門戶) | microsoft.cdn/cdnwebapplicationfirewallpolicies |
AzureHybrid | microsoft.network/expressroutecircuits |
MicrosoftAzureCosmosDB | microsoft.dbforpostgresql/flexibleservers |
NetMon | microsoft.network/publicipprefixes |
AzureCdn | microsoft.cdn/profiles/endpoints |
Azure 診斷模式或資源特定模式
下列服務會根據診斷設定組態,針對其資源記錄使用 Azure 診斷模式或資源特定模式。 使用資源特定模式時,這些資源不會將數據傳送至 AzureDiagnostics 數據表。 如需此設定的詳細資訊,請參閱 Azure 資源記錄 。
服務名稱 | resourceType |
---|---|
API 管理 服務 | Microsoft.ApiManagement |
Azure Cosmos DB | Microsoft.DocumentDB/databaseAccounts |
資料處理站 (V2) | Microsoft.DataFactory |
復原服務保存庫(備份) | Microsoft.RecoveryServices/vaults |
防火牆 | Microsoft.Network/azureFirewalls |
AzureDiagnostics 表格資料行
資料行 | 類型 | 描述 |
---|---|---|
action_id_s | String | |
action_name_s | 字串 | |
action_s | String | |
ActivityId_g | Guid | |
AdditionalFields | ||
AdHocOrScheduledJob_s | 字串 | |
application_name_s | String | |
audit_schema_version_d | Double | |
avg_cpu_percent_s | String | |
avg_mean_time_s | String | |
backendHostname_s | String | |
Caller_s | 字串 | |
callerId_s | 字串 | |
呼叫者IP地址 | String | |
calls_s | String | |
類別 | String | |
client_ip_s | String | |
clientInfo_s | String | |
clientIP_s | String | |
clientIp_s | 字串 | |
clientIpAddress_s | 字串 | |
clientPort_d | Double | |
code_s | 字串 | |
collectionName_s | 字串 | |
conditions_destinationIP_s | String | |
conditions_destinationPortRange_s | 字串 | |
conditions_None_s | String | |
conditions_protocols_s | 字串 | |
conditions_sourceIP_s | String | |
conditions_sourcePortRange_s | 字串 | |
CorrelationId | 字串 | |
count_executions_d | Double | |
cpu_time_d | Double | |
database_name_s | String | |
database_principal_name_s | String | |
DatabaseName_s | String | |
db_id_s | 字串 | |
direction_s | 字串 | |
dop_d | Double | |
duration_d | Double | |
持續時間_毫秒_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 | String | |
event_time_t | Datetime | |
活動名稱_s | 字串 | |
execution_type_d | Double | |
executionInfo_endTime_t | DateTime | |
executionInfo_exitCode_d | Double | |
executionInfo_startTime_t | DateTime | |
host_s | String | |
httpMethod_s | String | |
httpStatus_d | Double | |
httpStatusCode_d | Double | |
httpStatusCode_s | String | |
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 | String | |
is_column_permission_s | 字串 | |
isAccessPolicyMatch_b | Bool | |
JobDurationInSecs_s | String | |
JobFailureCode_s | String | |
JobId_g | Guid | |
jobId_s | String | |
JobOperation_s | String | |
JobOperationSubType_s | String | |
JobStartDateTime_s | String | |
JobStatus_s | 字串 | |
JobUniqueId_g | Guid | |
層級 | String | |
log_bytes_used_d | Double | |
logical_io_reads_d | Double | |
logical_io_writes_d | Double | |
邏輯伺服器名稱_s | 字串 | |
macAddress_s | 字串 | |
matchedConnections_d | Double | |
最大 CPU 時間 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 | 字串 | |
平均時間_秒 | String | |
訊息 | String | |
min_time_s(最小時間秒) | String | |
msg_s | String | |
num_physical_io_reads_d | Double | |
object_id_d | Double | |
object_name_s | 字串 | |
操作名稱 | 字串 | |
OperationVersion | String | |
partitionKey_s | String | |
physical_io_reads_d | Double | |
plan_id_d | Double | |
policy_s | String | |
policyMode_s | String | |
primaryIPv4Address_s | String | |
priority_d | Double | |
properties_enabledForDeployment_b | Bool | |
properties_enabledForDiskEncryption_b | Bool | |
properties_enabledForTemplateDeployment_b | Bool | |
properties_s | String | |
properties_sku_Family_s | String | |
properties_sku_Name_s | 字串 | |
properties_tenantId_g | Guid | |
query_hash_s | String | |
query_id_d | Double | |
query_max_used_memory_d | Double | |
query_plan_hash_s | 字串 | |
query_time_d | Double | |
querytext_s | String | |
receivedBytes_d | Double | |
Region_s | 字串 | |
requestCharge_s | 字串 | |
requestQuery_s | 字串 | |
requestResourceId_s | 字串 | |
requestResourceType_s | 字串 | |
requestUri_s | String | |
reserved_storage_mb_s | String | |
資源 | String | |
resource_actionName_s | 字串 | |
resource_location_s | 字串 | |
resource_originRunId_s | String | |
resource_resourceGroupName_s | 字串 | |
resource_runId_s | 字串 | |
resource_subscriptionId_g | Guid | |
resource_triggerName_s | String | |
resource_workflowId_g | Guid | |
resource_workflowName_s | 字串 | |
ResourceGroup | 字串 | |
_ResourceId | 字串 | 記錄相關資源的唯一識別碼 |
資源提供者 | String | |
資源提供者 | 字串 | |
資源類型 | 字串 | |
ResourceType | 字串 | |
response_rows_d | Double | |
resultCode_s | String | |
ResultDescription | String | |
ResultDescription | 字串 | |
resultDescription_ChildJobs_s | 字串 | |
resultDescription_ErrorJobs_s | String | |
resultMessage_s | 字串 | |
ResultSignature | 字串 | |
結果類型 | String | |
結果類型 | String | |
rootCauseAnalysis_s | String | |
routingRuleName_s | 字串 | |
rowcount_d | Double | |
ruleName_s | String | |
RunbookName_s | String | |
RunOn_s | 字串 | |
schema_name_s | String | |
sentBytes_d | Double | |
sequence_group_id_g | Guid | |
sequence_number_d | Double | |
server_principal_sid_s | String | |
session_id_d | Double |