How can we print subscriptionname,resousce groupname using kql query in azure log analytics
its showing vmname but need these details. this is kql query in azure log analytics
let start_time=startofday(datetime("2019-03-01 00:00:00 AM"));
let end_time=endofday(datetime("2019-03-31 11:59:59 PM"));
Heartbeat
| where TimeGenerated > start_time and TimeGenerated < end_time
| summarize heartbeat_per_hour=count() by bin_at(TimeGenerated, 1h, start_time), Computer
| extend available_per_hour=iff(heartbeat_per_hour>0, true, false)
| summarize total_available_hours=countif(available_per_hour==true) by Computer
| extend total_number_of_buckets=round((end_time-start_time)/1h)
| extend availability_rate=total_available_hours*100/total_number_of_buckets
2
Answers
The Azure Resource Graph seems more appropriate for retrieving this information.
Thanks @VenkateshDodda for pointing towards the right direction. After making few changes, I ran below query with the given time stamp, and it worked as expected.
Refer MSDoc for more relevant information.