Analytics in Application Insights

Analytics is the powerful search feature of Application Insights. These pages describe the Log Analytics query language.

Queries in Analytics

A typical query is a source table followed by a series of operators separated by |.

For example, let's find out what time of day the citizens of Hyderabad try our web app. And while we're there, let's see what result codes are returned to their HTTP requests.

requests
| where timestamp > ago(30d)
| summarize ClientCount = dcount(client_IP) by bin(timestamp, 1h), resultCode
| extend LocalTime = timestamp - 4h
| order by LocalTime desc
| render barchart

We count distinct client IP addresses, grouping them by the hour of the day over the past 7 days.

Note

To get results outside the previous 24h, either include 'timestamp' explicitly in your query, or use the time range drop-down menu.

Let's display the results with the bar chart presentation, choosing to stack the results from different response codes:

Choose bar chart, x and y axes, then segmentation

Looks like our app is most popular at lunchtime and bed-time in Hyderabad. (And we should investigate those 500 codes.)

There are also powerful statistical operations:

Results of statistical query

The language has many attractive features:

  • Filter your raw app telemetry by any fields, including your custom properties and metrics.
  • Join multiple tables – correlate requests with page views, dependency calls, exceptions and log traces.
  • Powerful statistical aggregations.
  • Just as powerful as SQL, but much easier for complex queries: instead of nesting statements, you pipe the data from one elementary operation to the next.
  • Immediate and powerful visualizations.
  • Pin charts to Azure dashboards.
  • Export queries to Power BI.
  • There's a REST API that you can use to run queries programmatically, for example from Powershell.

Connect to your Application Insights data

Open Analytics from your app's overview blade in Application Insights:

Open portal.azure.com, open your Application Insights resource, and click Analytics.

Video

Analytics

Query examples

Try these walkthroughs to illustrate the power of using Analytics:

Next steps