An administrator needs to analyze diagnostic logs for several Azure Key Vaults. The logs are collected in a Log Analytics workspace named LogsWS.
The administrator wants to retrieve the total number of operations for each Key Vault resource over the past 24 hours, grouped by the operation name.
Which Kusto Query Language (KQL) query should the administrator execute to achieve this objective?
- AzureDiagnostics
| where TimeGenerated > ago(24h)
| where ResourceProvider == "MICROSOFT.KEYVAULT"
| summarize count() by Resource, OperationNameAnswer - BAzureDiagnostics
| where ResourceProvider == "MICROSOFT.KEYVAULT"
| summarize count() by Resource, OperationName
| where TimeGenerated > ago(24h) - CAzureDiagnostics
| where TimeGenerated > ago(24h)
| where ResourceProvider = "MICROSOFT.KEYVAULT"
| group by Resource, OperationName - DAzureDiagnostics
| select TimeGenerated, Resource, OperationName, ResourceProvider
| where TimeGenerated > ago(24h) and ResourceProvider == "MICROSOFT.KEYVAULT"
| summarize count() by Resource, OperationName
Answer
The KQL query that filters by TimeGenerated and ResourceProvider before aggregating counts using the summarize operator.
The correct query evaluates the filters before summarizing the results. This represents syntactically correct KQL and respects the pipeline mechanism where columns are stripped after summarization.
Step-by-Step Solution
Key Concept
Kusto Query Language pipeline execution flow and schema transformation behavior.