【问题标题】:How to index a column in kusto query after pivot for azure log alertsazure 日志警报透视后如何在 kusto 查询中索引列
【发布时间】:2021-01-14 19:37:30
【问题描述】:

我在 Azure 中将以下 kusto 查询用作日志查询

traces
| where message contains "SWSE"
| extend d=parse_json(message)
| extend Info=tostring(d.message)
| where Info startswith "Borrow Token" or Info startswith "Return Token" 
| extend  tAction = tostring( split(Info,' ',0)[0])
| summarize count_=count() by tAction, timebox=bin(timestamp, 10m)
| evaluate pivot(tAction,sum(count_))
| extend  diff = abs(Borrow-Return)
| where diff>2

导致

但是,此行在导入日志警报时被标记为错误,而不是在针对 Azure 日志运行时。

| extend  diff = abs(Borrow-Return)

出现错误:

The request had some invalid properties

还有其他方法可以引用这些列吗?

【问题讨论】:

    标签: azure logging azure-data-explorer alerts


    【解决方案1】:

    pivot() 插件的输出架构不是确定性的,取决于输入数据 - 如果您期望的列实际上不存在于输出架构中,您可能需要使用 column_ifexists()

    例如:

    | extend diff = abs(column_ifexists("Borrow", 0) - column_ifexists("Return", 0))
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-11-14
      • 2022-12-05
      • 1970-01-01
      • 2016-06-01
      • 1970-01-01
      • 2020-05-25
      相关资源
      最近更新 更多