【问题标题】:Kusto query multiple resources by type, not by nameKusto 按类型而不是名称查询多个资源
【发布时间】:2021-09-09 05:01:28
【问题描述】:

我编写了一个简单的查询,显示来自多个 Application Insights 实例的异常:

app('app_insights_name_1').exceptions
| more unions here
| union app('app_insights_name_n').exceptions
| where timestamp > ago(24h)
| summarize count() by problemId, appName
| sort by count_ desc

我还设法编写了一个查询来查找我希望第一个查询运行的所有 App Insights 实例:

resources
| where type in ~('microsoft.insights/components', 'microsoft.insights')
| where(resourceGroup in ~('dev', 'test'))

我认为不可能将这两个查询结合起来,但我想知道是否可以查询一个或多个资源组中给定类型的所有实例的异常表(或 Trace 或任何其他)的联合?

从概念上讲,我希望得到类似于以下查询的内容:

resources
| where type in ~('microsoft.insights/components', 'microsoft.insights')
| where(resourceGroup in ~('dev', 'test'))
| MAGIC_HERE : get union of all exception tables from above 
| where timestamp > ago(24h)
| summarize count() by problemId, appName
| sort by count_ desc

【问题讨论】:

    标签: azure-log-analytics kql azure-monitoring


    【解决方案1】:

    正如以下tech community blog 中所建议的,您可以使用工作簿集成日志分析和 Azure 资源图。

    app 表达式用于 Azure Monitor 查询,以从同一资源组、另一个资源组或另一个订阅中的特定 Application Insights 应用检索数据。这对于在 Azure Monitor 日志查询中包含应用程序数据以及在 Application Insights 查询中跨多个应用程序查询数据非常有用。

    Resources 是 Azure 中资源图资源管理器服务中的一个表,旨在通过提供高效和高性能的资源探索以及跨给定订阅集进行大规模查询的能力来扩展 Azure 资源管理,以便您可以有效地管理你的环境。这些查询提供以下功能:

    • 能够通过资源属性进行复杂的过滤、分组和排序来查询资源。
    • 能够根据治理要求迭代探索资源。
    • 能够评估在庞大的云环境中应用策略的影响。
    • 能够detail changes made to resource properties(预览版)。

    这里是参考git hub 创建应用洞察工作簿。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-04-02
      • 1970-01-01
      • 2021-03-06
      • 2015-04-13
      • 1970-01-01
      • 2012-05-06
      相关资源
      最近更新 更多