有没有一种方法可以使用bin()函数获得零结果? [英] Is there a way to get zero results using bin() function?

查看:76
本文介绍了有没有一种方法可以使用bin()函数获得零结果?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我同时对Log Analytics和App Insights使用Analytics(分析)工具时,我经常会"bin()"在一起以1-5分钟为增量进行计算,并使用count()查看事件的发生.但是此功能的本质是它仅告诉我什么时候发生 并且不包括什么都没发生"的时间段.像bin()一样,还有另一个函数可以在与count()一起使用时包含非出现次数吗?

When I use the Analytics tool for both Log Analytics and App Insights, I often "bin()" together results by 1-5 minute increments and use count() to see the occurances. But the nature of this function is that it only tells me when something happens and doesn't include periods where *nothing* happened. Is there another function like bin() that could include the non-occurances when used with count()?

示例:

W3CIISLog
|由csUriStem汇总count(),bin(TimeGenerated,5m)
|渲染时间表

W3CIISLog
| summarize count() by csUriStem, bin(TimeGenerated, 5m)
| render timechart 

如果一个小时未使用uri,则折线图将显示一条直线,从下午5点的5次出现到下午6点的5次出现,但不会显示在这段时间中没有任何事发生.条形图可以显示我在寻找什么,但是它可以 非常拥挤.

If a uri isn't used for, say, an hour, then a line graph will show a straight line from 5 occurrences at 5 PM to 5 occurrences at 6 PM, but not display that *nothing* happened between that time. A bar chart sort of displays what I'm looking for, but it gets very crowded.

希望这个问题是有道理的.我真的很想知道是否存在一个现有功能或一组功能来实现我想做的事情.

Hopefully this question makes sense. I'd really like to know if an existing function or set of functions exists to achieve what I'm trying to do.

推荐答案

对于可能正在阅读此内容的其他人,类似的查询将如下所示:

For others that may be reading this, a similar query would look like this:

https://analytics.applicationinsights.io/demo#

customEvents
| where name == "Clicked My Profile Button"
| summarize count() by bin(timestamp, 1m)
| render timechart 

尽管您也许能够看清第1行中的缺口,但充其量很难读懂.或者,您可以使用 制作系列,而不是摘要:

While you might be able to look at gaps in the 1 line, it's difficult to read at best.  Alternatively, you could use make-series instead of summarize:

customEvents
| where name == "Clicked My Profile Button"
| make-series count() default=0 on timestamp in range(ago(1d), now(), 1m)
| render timechart 

有关更多信息,请参见此技术社区的答案:

See this tech community answer for more information:


这篇关于有没有一种方法可以使用bin()函数获得零结果?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆