在 Azure Log Analytics 中查询多个表
Query multiple tables in Azure Log Analytics
我正在查看 Web 应用程序的 Azure 日志分析,我有多个开箱即用的 "tables" 包含数据:traces
、requests
、exceptions
,等等
我可以构造一个对来自多个表的数据运行的查询吗?我不想加入来自不同来源的数据,我只想 concatenate/interleave 它,所以我可以寻找例如"all traces and exceptions that contain the string 'SQL'".
理论上,类似于:
traces, exceptions
| where * contains "SQL"
| order by timestamp desc
| limit 100
这可能吗?
你可以使用 union
。我发现非常有用的是将所有表与 union *
合并。例如:
union *
| where * contains "SQL"
这样您将在所有表中搜索包含 SQL
的任何列
如果您想要特定的表格(例如 traces
和 exceptions
):
traces
| union exceptions
| where * contains "SQL"
您可能还想考虑 search
运算符
search in (exceptions, traces) "SQL"
| order by timestamp desc
| take 100
我正在查看 Web 应用程序的 Azure 日志分析,我有多个开箱即用的 "tables" 包含数据:traces
、requests
、exceptions
,等等
我可以构造一个对来自多个表的数据运行的查询吗?我不想加入来自不同来源的数据,我只想 concatenate/interleave 它,所以我可以寻找例如"all traces and exceptions that contain the string 'SQL'".
理论上,类似于:
traces, exceptions
| where * contains "SQL"
| order by timestamp desc
| limit 100
这可能吗?
你可以使用 union
。我发现非常有用的是将所有表与 union *
合并。例如:
union *
| where * contains "SQL"
这样您将在所有表中搜索包含 SQL
的任何列如果您想要特定的表格(例如 traces
和 exceptions
):
traces
| union exceptions
| where * contains "SQL"
您可能还想考虑 search
运算符
search in (exceptions, traces) "SQL"
| order by timestamp desc
| take 100