1
votes

I can't figure out why batches in Azure log analytics queries do not work as I expect from documentation. For example, this query should return two tabular results.

let m = materialize(StormEvents | summarize n=count() by State);
m | where n > 2000;
m | where n < 10

I try to do the same, and always get result only for the first of my subqueries, e.g. in this case only one table and one entry is returned, while the second subquery is not executed (I can leave mistakes in it and they are not caught upon execution).

let someMetrics = materialize (customMetrics | where timestamp > ago (1h));
someMetrics | take 1;
someMetrics | take 3
1

1 Answers

1
votes

I think this is limitation of the current Analytics UI. If you submit this query through API layer (DEMO is here), it will come back with two tables.

Here is curl script for reference:

curl "https://api.applicationinsights.io/v1/apps/DEMO_APP/query?query=let%20req%20%3D%20materialize(requests%7C%20where%20timestamp%20%3E%20ago(10m))%3Breq%20%7C%20take%201%3Breq%20%7C%20take%202" -H "x-api-key: DEMO_KEY"

This will return two tables (two metadata parts, one for each table + two result sets, one after each metadata).