Forum Discussion
updating my OMS queries
- May 10, 2019
Hi Richard_Hooper and @vicky2019
ProtectionStatus | summarize Rank = max(ProtectionStatusRank) by Computer | where Rank == "250"
You'd actually write it like the above example, a search is unnecessary as you know the table you are looking at.
You can run the above in the free demo portal https://portal.loganalytics.io/Demo?q=H4sIAAAAAAAAAwsoyi9JTS7JzM8LLkksKS1W4OWqUSguzc1NLMqsSlVIzi%2FNK9HQ1FEISszLVrBVyE2s0AhA0wKS0lRIqlRwzs8tKC1JLQKbUZ6RWpQK1WaroGRkaqDEBQD%2Fa%2B4LbQAAAA%3D%3D×pan=P1DThere are Rank==250 entries available there for you to test your code on. I'd also probably do a count of the records and a top 5 or 10 like this:
ProtectionStatus | summarize count(), Rank = max(ProtectionStatusRank) by Computer | where Rank == "250" | top 5 by count_ desc
Using limit or top of 500,000 isn't necessary (10k records is default max returned anyway). The fact you are using a summarize massively reduces the return record count (usually) as well.
There is also a dedicated Log Analytics page on tech Community here https://techcommunity.microsoft.com/t5/Azure-Log-Analytics/bd-p/AzureLogAnalytics
Hi Richard_Hooper and @vicky2019
ProtectionStatus | summarize Rank = max(ProtectionStatusRank) by Computer | where Rank == "250"
You'd actually write it like the above example, a search is unnecessary as you know the table you are looking at.
You can run the above in the free demo portal https://portal.loganalytics.io/Demo?q=H4sIAAAAAAAAAwsoyi9JTS7JzM8LLkksKS1W4OWqUSguzc1NLMqsSlVIzi%2FNK9HQ1FEISszLVrBVyE2s0AhA0wKS0lRIqlRwzs8tKC1JLQKbUZ6RWpQK1WaroGRkaqDEBQD%2Fa%2B4LbQAAAA%3D%3D×pan=P1D
There are Rank==250 entries available there for you to test your code on. I'd also probably do a count of the records and a top 5 or 10 like this:
ProtectionStatus | summarize count(), Rank = max(ProtectionStatusRank) by Computer | where Rank == "250" | top 5 by count_ desc
Using limit or top of 500,000 isn't necessary (10k records is default max returned anyway). The fact you are using a summarize massively reduces the return record count (usually) as well.
There is also a dedicated Log Analytics page on tech Community here https://techcommunity.microsoft.com/t5/Azure-Log-Analytics/bd-p/AzureLogAnalytics
Thank you so much Clive that worked !!
I'll join the Log Analytics community as well I have few other ones that needs correction.