3

我对 Azure Kusto 查询语言相当陌生。我正在尝试输出 2 个变量。这必须是非常简单的事情,我只是不知道如何。我曾尝试使用数据表、make-series、打印等功能,但无济于事。这是我当前的代码:

let allrequests = requests | project itemCount, resultCode, success, timestamp | where timestamp > now(-1h) and timestamp < now(-5m);

let requestcount = allrequests | summarize sum(itemCount);

let errorcount = allrequests | where toint(resultCode) >= 400 and toint(resultCode) <= 499 | summarize sum(itemCount);

requestcount; errorcount
4

2 回答 2

4

使用union是一种方法,但如果您希望它们在单行上使用print语句(docs):

let requestcount = requests
 | summarize sum(itemCount);
let errorcount = exceptions
 | summarize count();
print requests = toscalar(requestcount), exceptions = toscalar(errorcount)
于 2019-12-11T10:48:32.763 回答
0

我想到了。您可以使用联合运算符连接结果。

let allrequests = requests | project itemCount, resultCode, success, timestamp | where timestamp > now(-1h) and timestamp < now(-5m);

let requestcount = allrequests | summarize sum(itemCount);

let errorcount = allrequests | where toint(resultCode) >= 400 and toint(resultCode) <= 499 | summarize sum(itemCount);

errorcount | union requestcount
于 2019-12-11T09:48:00.997 回答