az monitor log-analytics

Commands for querying data in Log Analytics workspaces.

Commands

az monitor log-analytics query Query a Log Analytics workspace.

az monitor log-analytics query

Query a Log Analytics workspace.

az monitor log-analytics query --analytics-query
--workspace
[--timespan]
[--workspaces]

Examples

Execute a simple query over past 3.5 days.

az monitor log-analytics query -w b8317023-66e4-4edc-8a5b-7c002b22f92f --analytics-query "AzureActivity | summarize count() by bin(timestamp, 1h)" -t P3DT12H

Required Parameters

--analytics-query

Query to execute over Log Analytics data.

--workspace -w

GUID of the Log Analytics Workspace.

Optional Parameters

--timespan -t

Timespan over which to query. Defaults to querying all available data.

--workspaces

Additional workspaces to union data for querying. Specify additional workspace IDs separated by space.