sam0673
sam0673

Reputation: 201

How do I display a timechart with more than one custom metric in Azure Logs with Kusto Query Language

I have the following Logs in Azure Logs:

enter image description here

The query for the above is as follows:

enter image description here

The output is shown below appearing like a 'scatter diagram' but I am looking for a timechart - like connecting the dots but failed to do so:

enter image description here

How do I join the dots or is there a limitation or the way the KQL above (Kusto Query Language) is written?

Upvotes: 2

Views: 6479

Answers (1)

Bhargavi Annadevara
Bhargavi Annadevara

Reputation: 5512

It is your KQL query that has to be modified. The key to getting your time-series charts right is to fetch all the time and metric information in the result set from your query.

Remember that when constructing a timechart, the first column is the x-axis, and should be datetime. Other (numeric) columns are y-axes. There is one string column whose values are used to "group" the numeric columns and create different lines in the chart (further string columns are ignored).

Considering the requests table as an example (you can apply it to your customEvents data as appropriate), multiple metrics can be plotted as:

# Time-series chart with multiple metrics
requests
| summarize Requests = count(), Users = dcount(user_Id) by bin(timestamp, 1h)
| render timechart

Output: Plot multiple metrics

The query control uses timestamp for the X-axis and Requests & Users as separate series on the Y-axis here.

Upvotes: 5

Related Questions