0

In Azure Monitor for Application Insights how do you make a bar chart using a search term where the results are grouped by day? If you have large logs in Application Insights but want to print a bar chart where they are grouped by day using the Kusto language.

jmbmage
  • 2,487
  • 3
  • 27
  • 44

1 Answers1

1
// replace "my search term" with yours

union isfuzzy=true
    availabilityResults,
    requests,
    exceptions,
    pageViews,
    traces,
    customEvents,
    dependencies
| where * has "my search term"
| summarize Requests = count() by day = toint(format_datetime(timestamp, 'd'))
| order by day asc
| render barchart

union

This pulls together all the different types of Azure Monitor log records, you can comment some out if you are only looking for traces.

where

the * operator looks in all the searchable properties inside each element in the union

summarize

this is the equivalent of a group by statement where we build the x-axis of the bar as the Requests property and then group them by day for the y-axis. The timestamp is converted to a date of the month value (1,2,3...31) and then converted to integer

order by

order the elements by the day ascending

render

render by barchart, remember there are Chart Formatting settings next to the Chart in Azure Monitor where you can fine tune the output

date range

the date range is handled by the Time range control above the Azure Monitor log editor window.

Visualizations charts
Kusto reference

jmbmage
  • 2,487
  • 3
  • 27
  • 44