Log Analytics Group Process instances into one process name

Log Analytics Group Process instances into just one process name

我是 运行 以下查询,它 return 向我发送该服务的多个实例,例如 firefox 和 firefox#1 firefox#2。

当我显示图表时,我得到多行而不是 Firefox 的一行,所有 3 个实例的平均值合并为一个。

Perf

| where InstanceName 
has "firefox" 
and CounterValue > 0

| summarize ProcessorUsage = avg(CounterValue)
by bin(TimeGenerated, 
5m), InstanceName 

因此,除了 return firefox#1 和 firefox#2 之外,是否可以对所有 3 个的平均值进行分组。

我希望能够看到 CPU VM 上每个进程的使用情况,而不是看到同一应用程序的多个实例。

更新 0809: 添加另一个实例,如 chrome

Perf 
| where  (InstanceName has "firefox" and CounterValue >0) or (InstanceName has "chrome" and CounterValue >0)
| extend new_InstanceName = iif(InstanceName has "firefox", "firefoxavg","chromeavg" ) 
| summarize ProcessorUsage = avg(CounterValue) by bin(TimeGenerated, 5m), new_InstanceName

您可以为包含 "firefox" 的记录添加一个新列(使用扩展运算符),然后在摘要句子中使用新列。

代码如下:

Perf
| where InstanceName has "firefox" and CounterValue > 0
| extend new_InstanceName ="firefoxavg"
| summarize ProcessorUsage = avg(CounterValue) by bin(TimeGenerated, 5m), new_InstanceName