azure-application-insights - Application Insights - 查询集合
问题描述
我正在使用 Serilog 将数据跟踪到 Application Insights。
在自定义属性中,serilog 将故障集合记录为自定义数据,如下所示...
faults.Count 2
faults.0 "SomeFault"
faults.1 "AnotherFault"
如何使用 Application Insights Analytics 查询语言查询这些属性?
我想报告包含"AnotherFault"
不知道索引的任何响应。
解决方案
它可以很简单:
search in (CustomEvents) "AnotherFault"
或者,您可以将搜索限制为仅自定义维度:
CustomEvents
| where timestamp > ago(24h)
| where tostring(customDimensions) contains "AnotherFault"
由于字符串包含比较,两者都将对大型数据集产生性能影响,因此了解索引或名称或属性肯定会在这里有所帮助。
另一种方法是执行| mvexpand
每个自定义维度并将其展开到自己的行中:
CustomEvents
| where timstamp > ago(24h)
| project customDimensions, usefulField1, usefulField2,....
| mvexpand bagexpansion=array customDimensions
| where customDimensions[1] == "AnotherFault"
通过将其转换为数组,您可以通过通用 [1] 而不是通过知道其名称来访问自定义维度的值,因此您可以在不使用“faults.#”语法的情况下与“AnotherFault”进行完整比较。mvexpand
诀窍是在减少内存倍增之前减少您希望看到的字段数量。
推荐阅读
- machine-learning - 用于分类/多类分类的梯度提升树的弱学习器
- mysql - Javascript-无法读取 null 的属性值
- python - 返回中序遍历列表
- javascript - Java脚本中的动态日期计算
- mysql - laravel 具有整数值的多个连接条件
- c - GCC:gcc 4.8 版本的“多重定义”问题
- python - Python从字符串块中去除连字符
- key - 是否有正式的命令来获取 rsa 密钥形式的 sig 文件?
- node.js - gridfs-stream 图像发布生成的集合,但请求永远不会完成
- java - spring-batch 读入 null int 值