Unable to get "Ingestion Volume" from log Analytics Workspace via Azure Rest API

Sameer Dayal 0 Reputation points
2024-10-10T14:23:21.07+00:00

Hi, trying to capture "Ingestion Volume" from Azure Log analytics using the Azure Rest API. Buts the

script "js_workspace_usage",type: "javascript" do

  code = <<-EOS function filterUsage(data)

{ var usage = []; data.forEach(function(workspace) {

        if (workspace.properties.ingestion > 100) {

          usage.push({ workspace_id: workspace.id,

            workspace_name: workspace.name, daily_data_ingestion: workspace.properties.ingestion

          }); } });

      return usage; } EOS
Azure Cost Management
Azure Cost Management
A Microsoft offering that enables tracking of cloud usage and expenditures for Azure and other cloud providers.
2,673 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Rahul Podila 110 Reputation points Microsoft Vendor
    2024-11-01T14:09:52.9066667+00:00

    Hi @Sameer Dayal
    Welcome to the Microsoft Q&A Platform! Thank you for asking your question here. 

    It seems like you are trying to capture the "Ingestion Volume" from Azure Log Analytics using the Azure REST API. The code you have provided is a JavaScript function that filters the usage data and returns the workspaces that have a daily data ingestion greater than 100. 

    To capture the "Ingestion Volume" from Azure Log Analytics using the Azure REST API, you can use the following API endpoint: 

    https://api.loganalytics.io/v1/workspaces/{workspaceId}/usage 
    You will need to replace {workspaceId} with the ID of your Log Analytics workspace. This API endpoint returns the usage data for the specified workspace, including the daily data ingestion. 

    You can use the Azure REST API to make a GET request to this endpoint and retrieve the usage data. Here is an example of how to make a GET request to this endpoint using the Azure CLI: 

    az rest --method GET --uri "https://api.loganalytics.io/v1/workspaces/{workspaceId}/usage"  This will return the usage data for the specified workspace in JSON format. You can then parse the JSON data and extract the "Ingestion Volume" for the workspace. 

    If you have any further queries, do let us know  

    ---------------------------------------------------------------------------------------------------------  

     If the answer is helpful, please click "Accept Answer" and "Upvote it" 


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.