Microsoft Azure - Track CPU Utilization of a Azure Virtual Machines using KQL Log Query
Last Updated :
23 Jul, 2025
In this article, we will look into the process of finding the Minimum, Average, and Maximum CPU Utilization of all Azure Virtual Machines using KQL Log Query.
Here the Perf KQL Counter Operator is used to find Azure Virtual Machines performance from collected data logs.
Implementation:
Follow the below steps to Run the Log Queries.
Step 1: Log in to Azure Portal.
Step 2: Search/Go to Log Analytics Workspace and select your Log Analytics Workspace. Create one if you don't have any and enable agent configurations.

- Then, from the left menu navigate to General >> Logs.
Now, Paste the below Queries to get the log data.
Before Running the Query understand the Query Syntax.
Explanation for all the below examples :
Here, Perf represents performance, this is an operator which is used to fetch the performance logs of Azure Compute resources like Azure VMs, SQL Servers, Disk Storage etc.
We are using the ObjectName == "Processor" and CounterName == "% Processor Time" both these conditions filter the process components of Windows and Linux VMs using a where keyword.
TimeGenerated > ago(7d) or TimeGenerated > ago(5h) helps in filter the logs collected within that timespan.
With summarize keyword we are rendering the required data in the form of a table chart.
KQL Queries for Analysing CPU Performance of Azure VMs.
Example: To find Minimum CPU Utilization of Azure Virtual Machines for the last 7 days.
Perf
| where ObjectName == "Processor" and CounterName == "% Processor Time" and InstanceName == "_Total"
| where TimeGenerated > ago(7d)
| summarize MIN_CPU = min(CounterValue) by Computer, _ResourceId
Output:
Example: To find Minimum CPU Utilization of Azure Virtual Machines for the last 5 hours
Perf
| where ObjectName == "Processor" and CounterName == "% Processor Time" and InstanceName == "_Total"
| where TimeGenerated > ago(5h)
| summarize MIN_CPU = min(CounterValue) by Computer, _ResourceId
Output:
Example: To find Average CPU Utilization of Azure Virtual Machines for the last 7 days
Perf
| where ObjectName == "Processor" and CounterName == "% Processor Time" and InstanceName == "_Total"
| where TimeGenerated > ago(7d)
| summarize AVG_CPU = avg(CounterValue) by Computer, _ResourceId
Output:
Example: To find Average CPU Utilization of Azure Virtual Machines for the last 5 hours.
Perf
| where ObjectName == "Processor" and CounterName == "% Processor Time" and InstanceName == "_Total"
| where TimeGenerated > ago(5h)
| summarize AVG_CPU = avg(CounterValue) by Computer, _ResourceId
Output:
Example: To find Maximum CPU Utilization of Azure Virtual Machines for the last 7 days.
Perf
| where ObjectName == "Processor" and CounterName == "% Processor Time" and InstanceName == "_Total"
| where TimeGenerated > ago(7d)
| summarize MAX_CPU = max(CounterValue) by Computer, _ResourceId
Output:
Example: To find Maximum CPU Utilization of Azure Virtual Machines for the last 5 hours.
Perf
| where ObjectName == "Processor" and CounterName == "% Processor Time" and InstanceName == "_Total"
| where TimeGenerated > ago(2h)
| summarize MAX_CPU = max(CounterValue) by Computer, _ResourceId
Output:
Example: To analyze VM CPU Utilization of Minimum, Average and Maximum for last 7 days in a single table chart.
Perf
| where ObjectName == "Processor" and CounterName == "% Processor Time" and InstanceName == "_Total"
| where TimeGenerated > ago(7d)
| summarize MIN_CPU = min(CounterValue), AVG_CPU = avg(CounterValue), MAX_CPU = max(CounterValue) by Computer, _ResourceId
Output:
Example: To analyze VM CPU Utilization of Minimum, Average and Maximum for last 5 hours in a single table chart.
Perf
| where ObjectName == "Processor" and CounterName == "% Processor Time" and InstanceName == "_Total"
| where TimeGenerated > ago(5h)
| summarize MIN_CPU = min(CounterValue), AVG_CPU = avg(CounterValue), MAX_CPU = max(CounterValue) by Computer, _ResourceId
Output:
Note: This process works for both the OS Types. i.e., Windows and Linux.
That's it we are done.
Similar Reads
DevOps Tutorial DevOps is a combination of two words: "Development" and "Operations." Itâs a modern approach where software developers and software operations teams work together throughout the entire software life cycle.The goals of DevOps are:Faster and continuous software releases.Reduces manual errors through a
7 min read
Introduction
What is DevOps ?DevOps is a modern way of working in software development in which the development team (who writes the code and builds the software) and the operations team (which sets up, runs, and manages the software) work together as a single team.Before DevOps, the development and operations teams worked sepa
10 min read
DevOps LifecycleThe DevOps lifecycle is a structured approach that integrates development (Dev) and operations (Ops) teams to streamline software delivery. It focuses on collaboration, automation, and continuous feedback across key phases planning, coding, building, testing, releasing, deploying, operating, and mon
10 min read
The Evolution of DevOps - 3 Major Trends for FutureDevOps is a software engineering culture and practice that aims to unify software development and operations. It is an approach to software development that emphasizes collaboration, communication, and integration between software developers and IT operations. DevOps has come a long way since its in
7 min read
Version Control
Continuous Integration (CI) & Continuous Deployment (CD)
Containerization
Orchestration
Infrastructure as Code (IaC)
Monitoring and Logging
Microsoft Teams vs Slack Both Microsoft Teams and Slack are the communication channels used by organizations to communicate with their employees. Microsoft Teams was developed in 2017 whereas Slack was created in 2013. Microsoft Teams is mainly used in large organizations and is integrated with Office 365 enhancing the feat
4 min read
Security in DevOps