日志分析将进程实例分组到一个进程名称中



我正在运行以下查询,它向我返回了该服务的多个实例,例如火狐和火狐#1火狐#2。

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

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

因此,与其返回 firefox#1 和 firefox#2,不如对所有 3 个的平均值进行分组。

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

> 更新 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

最新更新