Forum Discussion
tmitchel
Oct 10, 2019Copper Contributor
Azure Log Analytics for Server Uptime
Hello,
Been working on this Kusto query. Just was wondering how do I get a specific order of columns. I want Computer as first column, Availability as second, Total_Hours as third, and Available_Hours as fourth. It just jumbles the order on me
let start_time=startofmonth(now());
let end_time=endofmonth(now());
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 Available_Hours=countif(available_per_hour==true) by Computer
| extend Total_Hours=round((end_time-start_time)/1h)
| extend Availability=Available_Hours*100/Total_Hours
3 Replies
- CliveWatsonFormer Employee
You can add this as a last line source
| project-reorder Availability, Total_Hours, Available_HoursHowever that will leave Computer as the final column (there seems to be an issue with Computer as it was used in the summarized command e.g. you can only reorder columns that don't follow a 'by' operator); I'll ask internally as this isn't working as i'd expect or I'm not understanding the usage.
Go to Log Analytics and Run Query
Availability Total_Hours Available_Hours Computer 33.60215053763441 744 250 On-Premise-16S 33.60215053763441 744 250 OnPremise-12S - CliveWatsonFormer Employee
@t does seems like this is actually to do with extended columns, I'm talking to the Product Group next week about this, and will keep you updated.
How much of an issue is it tmitchel ?
- ScottAllisonIron Contributor
CliveWatson Running into this myself... was there ever a resolution for the extended columns not sorting?