【问题标题】:Filter data from CustomEvent过滤来自 CustomEvent 的数据
【发布时间】:2020-12-31 16:12:41
【问题描述】:

我有以自定义事件格式保存的 azure Insights 中的数据。 现在我需要在我的网站中创建一个仪表板页面,该页面将从洞察力中提取数据并显示该数据的图表。 问题是我如何根据保存在那里的数据过滤来自 customEvents 的数据。比如基于自定义事件或自定义数据。

提供我可以看到 $filer、$search、$query 是如何工作的任何资源? 我在这里https://dev.applicationinsights.io/quickstart 但看起来还不够。

我尝试添加过滤器,例如 startswith(customEvent/name, 'BotMessageReceived')https://dev.applicationinsights.io/apiexplorer/events 但它不起作用。是说“运行查询时出现问题”, 我有名称以 BotMessageReceived 开头的 customEvents

谢谢 达尔维尔

【问题讨论】:

  • 请使用分析查询和您在问题中提到的api,例如https://api.applicationinsights.io/v1/apps/Your_application_id/query?query=events | where timestamp >ago(5h)

标签: azure azure-application-insights


【解决方案1】:

更新: 没有like 运算符,如果你想使用时间戳作为过滤器,你应该使用以下三种方法之一:

    customEvents 
    | where timestamp >= datetime('2018-11-23T00:00:00.000') and timestamp <= 
datetime('2018-11-23T23:59:00.000')


    customEvents
    | where tostring(timestamp) contains "2018-12-11"


    customEvents
    | where timestamp between(datetime('2018-11-23T00:00:00.000') .. 
datetime('2018-11-23T23:59:00.000') ) 

请使用这个:

customEvents
| where name startswith "BotMessageReceived"

如果你使用上面提到的api,你可以使用:

    https://api.applicationinsights.io/v1/apps/Your_application_id/query?
query=customEvents | where name startswith "BotMessageReceived"

它在我身边有效。

【讨论】:

  • 是的,它适用于查询。我们可以在搜索中应用like 运算符吗?我们该怎么做。例如,如果我想查询 timestap="2018-12-11" 与时间无关的所有记录。只想根据日期值查询
  • @FilmjamrMovies 没有 like 运算符,但它有一个 contains 运算符,如果它可以满足您的需要,我可以更新我的答案。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2019-07-26
  • 2018-10-26
  • 2021-01-12
  • 2015-09-29
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多