我有一个日志分析工作区,我向其中提供虚拟机指标。我想根据那里的数据渲染时间表,但是我遇到了一些问题。
第一个问题是我有很多机器和很多记录,这意味着它们重叠并且不是很有用,因此,我想将其保持在 10,例如平均百分比最高的 10 个虚拟机使用的内存。
也就是说,使用 top
或 limit
实际上会限制显示的数据量,因为它只会在图表上放置 10 个点,而不是限制显示的数据量我想要显示的虚拟机。如何限制虚拟机数量显示的数据?
这是我的查询:
Perf
| where ObjectName == "Memory" and CounterName == "% Used Memory"
| summarize UsedMemory = avg(CounterValue), any(Computer) by bin(TimeGenerated,15m)
| limit 10
| render timechart
谢谢。
最佳答案
您可以使用top operator和 partition operator .
示例查询应如下所示:
Perf
| where ObjectName == "Memory" and CounterName == "% Used Memory"
| summarize UsedMemory = avg(CounterValue) by bin(TimeGenerated,15m),Computer
| partition by Computer
(
top 1 by UsedMemory desc //fetch the highest value for each vm
)
| top 10 by UsedMemory desc //select the top 10 vm with the UsedMemory by descending
关于azure - KQL - 基于特定列限制数据量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63150240/