'How to access Azure log analytics via API


I am using Azure log analytics to collect metrics for our Blob Storage account. I have saved queries which I can run from Azure UI portal.

I want to access the same query results via API. I couldn't find any decent documentation on how this can be done.

Can someone point me into right direction?

thanks



Solution 1:[1]

  • The Log Analytics Query API is a REST API that allows you to query all of the data gathered by Azure Monitor logs using the same query language as the rest of the service.

  • You can use this API to create new data visualisations and improve Log Analytics' capabilities.

  • Navigate to the APIs my organization uses, search for Log Analytics API, add the Application permission

enter image description here

enter image description here

Query - Get

  • Execute an Analytics query
  • Executes an Analytics query for data
GET https://api.loganalytics.io/v1/workspaces/{workspaceId}/query?query={query}

Please refer MS Doc and this for more information

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 HarshithaVeeramalla-MT