The Wayback Machine - https://web.archive.org/web/20240120024546/https://www.geeksforgeeks.org/microsoft-azure-heartbeat-kql-log-monitoring-query/
Open In App
Related Articles

Microsoft Azure – Heartbeat KQL Log Monitoring Query

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Report issue
Report

Pre-requisites:

Heartbeat is an Azure Log Management solution and you can get/fetch the below following information from the KQL Log Heartbeat query.:

  • Computer Name
  • An Environment that hosts the computer: Azure or Non-Azure
  • Name of Operating system, Type of OS, Operating system major version, Operating system minor version
  • List of solutions deployed on the agent
  • The Version of the agent, etc.

Let’s see some below examples of Heartbeat KQL Log Monitoring Query:

1. KQL Query to find the Computer and Computer Environment that hosts the computer: Azure or Non-Azure

Heartbeat
| where OSType == 'Windows' or OSType == 'Linux'
| summarize arg_max(TimeGenerated, *) by SourceComputerId 
| sort by Computer
| project Computer, ComputerEnvironment
| render table

Output:

 

2. KQL Query to find the Computer OS Type,  OS Name OS Major Version, and OS Minor Version.

Heartbeat
| where OSType == 'Windows' or OSType == 'Linux'
| summarize arg_max(TimeGenerated, *) by SourceComputerId 
| sort by Computer
| project Computer, ComputerEnvironment, 
OSType, OSName, OSMajorVersion, OSMinorVersion
| render table

Output:

 

3. KQL Query to find the Computer with OS Type has only Windows and display OS Name OS Major Version and OS Minor Version.

Heartbeat
| where OSType == 'Windows'
| summarize arg_max(TimeGenerated, *) by SourceComputerId 
| sort by Computer
| project Computer, ComputerEnvironment, 
OSType, OSName, OSMajorVersion, OSMinorVersion
| render table

Output:

 

4. KQL Query to find the Computer with OS Type has only Linux and display OS Name OS Major Version and OS Minor Version.

Heartbeat
| where OSType == 'Linux'
| summarize arg_max(TimeGenerated, *) by SourceComputerId 
| sort by Computer
| project Computer, ComputerEnvironment, 
OSType, OSName, OSMajorVersion, OSMinorVersion
| render table

Output:

 

5. KQL Query to find the Computer Remote IP.

Heartbeat
| summarize arg_max(TimeGenerated, *) by SourceComputerId 
| sort by Computer
| project Computer, ComputerEnvironment, ComputerIP
| render table

Output:

 

Lost in the complex landscape of DevOps? It's time to find your way! Enroll in our DevOps Engineering Planning to Production Live Course and set out on an exhilarating expedition to conquer DevOps methodologies with precision and timeliness.
What We Offer:
  • Comprehensive DevOps Curriculum
  • Expert Guidance for Streamlined Learning
  • Hands-on Experience with Real-world Scenarios
  • Proven Track Record with 100,000+ Successful DevOps Enthusiasts

Commit to GfG's Three-90 Challenge! Purchase a course, complete 90% in 90 days, and save 90% cost click here to explore.
Last Updated : 31 Mar, 2023
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads
Complete Tutorials