Application Insights for Sitecore (or, where have my logfiles gone?)

So with Sitecore’s new Azure PaaS offering, you might’ve noticed in your Azure resource group that there’s an Application Insights resource there.

Application Insights can be used to monitor the live web applications and helps with diagnosing issues and figuring out what users are doing with your app. More information here. Application Insights is quite a big and powerful tool, and I won’t be able to cover everything juts quite yet. I will however run through some of the cool features.

health

Even by itself that’s a pretty cool (and useful) tool to have. But the Application Insights have actually also been integrated with Sitecore.

In the Application Insights overview blade we can get some additional information by clicking the Search button. We can filters the results there as well, by type (such as trace, request or page view) or property. For Sitecore’s log entries we are interested in the Trace filter.

trace

To query the log files in more depth, we can actually hit the Analytics button in that same overview blade. This will open a new window, where we can begin writing queries to find issues logged in our Sitecore logs.

insights

Any of the properties you see in the bottom right we can filter on – you can find those properties on the left hand side as well, in the Schema. There’s also some very useful documentation on writing queries.

In the Performance blade, I can also create my own charts based on Sitecore statistics, as well as see how my application is performing.

performance

We can also do things like set up alerts when there’s over 5 server exceptions in the application (see image below), and if this happens send an email to the administrators.

alerts

This type of reactive analytics isn’t the only thing you can do with Application Insights though – we can use some more advanced, proactive features. In the linked document, it states “For example, if your app loads slowly on some OS versions, or has slower responses in particular geographical location, you’ll get an email about it. Proactive Detection uses machine learning and data mining to help you find issues that would be hard to detect – and are often only discovered when customers complain.”

For more information about this type of diagnostics, see this Microsoft documentation.

Lastly, there’s also the Application Map, which allows you to see a diagram of your setup, showing the dependencies of your components.

appmap.png

By clicking through on the various components, we can see which parts of our setup are working correctly and which have issues. As you can see in the image above, there seems to be something wrong with my search. I can then click through on that to see some detailed information.

searchfailures.png

By clicking through on in the chart, I can also see even more detail (in the below image, I clicked the ‘Dependency Failures’ chart)

searchfailuredetail.png

From there I can then even create a new Work Item, either in Visual Studio Team Services or in GitHub, making sure the Work Items have all relevant data embedded.

I’ve covered only a small portion of what Application Insights can do for us, but I do hope I’ve shown its power and its usefulness. I’m pretty excited, in any case 🙂