Azure Monitor Log Analytics API Overview
The Log Analytics Query API is a REST API that lets you query the full set of data collected by Azure Monitor logs using the same query language used throughout the service. You can use this API to build new visualizations of your data and extend the capabilities of Log Analytics.
Log Analytics API Authentication
You must authenticate to access the Log Analytics API.
- To query your workspaces, you must use Azure Active Directory authentication.
- To quickly explore the API without using Azure AD authentication, you can use an API key to query sample data in a non-production environment.
Azure AD authentication for workspace data
The Log Analytics API supports Azure AD authentication with three different Azure AD OAuth2 flows:
- Authorization code
- Client credentials
The authorization code flow and implicit flow both require at least one user-interactive login to your application. If you need a completely non-interactive flow, you must use the client credentials flow.
After receiving a token, the process for calling the Log Analytics API is identical for all flows. Requests require the
Authorization: Bearer header, populated with the token received from the OAuth2 flow.
API key authentication for sample data
To quickly explore the API without using Azure AD authentication, we provide a demonstration workspace with sample data, which allows authenticating with an API key.
Log Analytics API Query Limits
See the Query API section of this page for information about query limits.
Trying the Log Analytics API
To try the API without writing any code, you can use:
- Your favorite client such as Fiddler or Postman to manually generate queries with a user interface.
- cURL from the command line, and then pipe the output into jsonlint to get readable JSON.