我正在查看 Web 应用程序的 Azure 日志分析,并且我有多个包含数据的现成“表”:traces
、requests
、 异常
等
我可以构造一个对多个表中的数据运行的查询吗?我不想加入来自不同来源的数据,我只想连接/交错它,所以我可以寻找例如“包含字符串‘SQL’的所有跟踪和异常”。
理论上,类似于:
traces, exceptions
| where * contains "SQL"
| order by timestamp desc
| limit 100
这可能吗?
最佳答案
您可以使用联合
。我发现非常有用的是将所有表与 union *
联合起来。例如:
union *
| where * contains "SQL"
这样您将在所有表中搜索包含 SQL 的任何列
如果您想要特定的表(例如跟踪
和异常
):
traces
| union exceptions
| where * contains "SQL"
[编辑] 还有一个较新的命令,具有相同的结果(与前一个命令没有优点或缺点)
search in (table1, table2, table3) "SQL"
| where timestamp > ago(6h)
关于azure - 查询 Azure Log Analytics 中的多个表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58615911/