In kql, how can I convert `make-series` in to table?

1.8k views Asked by At

The following query returns the data that I need:

let timeSpn = bin(ago(60m),1m);
requests
| where cloud_RoleName == "myApp"
| where success == "False"
| where timestamp > timeSpn
| make-series count() on timestamp from timeSpn to now() step 1m by application_Version

The problem is that the result consist of 2 lines (one for each application_Version and not 120 lines (one for each minute and for each version).

I have to use make-series and not the simple summarize because I need the "zero" values.

1

There are 1 answers

3
Leonardo On BEST ANSWER

You can do it using the mv-expand operator

Here's an example from Back-fill Missing Dates With Zeros in a Time Chart:

let start=floor(ago(3d), 1d);
let end=floor(now(), 1d);
let interval=5m;
requests
| where timestamp > start
| make-series counter=count() default=0 
              on timestamp in range(start, end, interval)
| mvexpand timestamp, counter
| project todatetime(timestamp), toint(counter)
| render timechart