azure - Kusto 查询语言 : set column name of summarize by evaluated expression

标签 azure azure-log-analytics azure-data-explorer kql

我再次问另一个与 Kusto 相关的问题(我真的希望某个地方有一个关于此问题的完整视频教程)。

我有一个 summarize 语句,它为 y 轴生成两列,为 x 轴生成一列。 现在我想重新标记 x 轴的列以显示一个字符串,该字符串也是我从数据库中获取的,并且已使用 let 放入变量中。

这基本上看起来像这样:

let android_col = strcat("Android: ", toscalar(customEvents
| where application_Version contains secondLatestVersionAndroid));
let iOS_col = strcat("iOS: ", toscalar(customEvents
| where application_Version contains secondLatestVersionIOS));

... some Kusto magic ...

| summarize
    Android = 100 - (round((countif(hasUnhandledErrorAndroid == 1 ) * 100.0 ) / countif(isAndroid == 1), 2)),
    iOS = 100 - (round((countif(hasUnhandledErroriOS == 1) * 100.0 ) / countif(isIOS == 1), 2))
    by Time
|render timechart with (ytitle="crashfree users in %", xtitle="date", legend=visible )

现在我想要显示的不是 Android 和 iOS 的摘要,而是 android_col 和 iOS_col 的值。

这可能吗?

最诚挚的问候 特立独行

最佳答案

一般情况下,建议预定义列名,否则各种功能无法使用。例如,IntelliSense 不会知道列的名称,因为它们仅在运行时确定。此外,如果您创建一个返回动态架构的函数,您将无法从其他集群运行此函数。

但是,如果您确实想更改列名称,那么您肯定有办法通过使用各种插件来实现。例如,bag_unpack , pivot以及其他。

至于 Kusto 上的类(class),Pluralsight 上其实有几门优秀的类(class)(都是免费的):

关于azure - Kusto 查询语言 : set column name of summarize by evaluated expression,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64332198/

相关文章:

azure - 使用 Python 中的托管身份向 Kusto 进行身份验证

带有 WHERE 子句的 Azure Log Analytics 查询不会产生任何结果

c# - 将批处理事件发送到 azure eventhub 时失败

azure - 是否有任何 PowerShell 命令可以获取已分配或未分配 JIT(即时)的所有 Azure VM 的详细信息?

azure - Visual Studio 2017 - 部署到 Azure Function v2 (.NetCore v2.1) 错误 : required process (“Web Management Service” ) is started

azure - 如何使用 .Net API 中的托管标识连接 Azure 日志分析工作区

c# - 如何删除 Log Analytics 数据收集器 API 创建的自定义日志

Azure 负载均衡器日志分析

azure - 无法在 VSCode 中调试 Azure Functions Core Tools

azure-data-explorer - 是否可以在 Azure 数据资源管理器 (Kusto) 中更新行