Skip to main content

Troubleshoot your Sitecore environment using these Application Insightsquery

Sitecore sends what you would expect (errors, warnings, info logs) to Application Insights from a log perspective. In Application Insights, you can identify error and warning messages, identify messages from specific roles and Sitecore instances, and search for specific log messages.

sitecoreapplicationinsight

For further information related to Sitecore logs, you can refer this Sitecore document: Analyze Sitecore logs with Application Insights and Sitecore KB Access logs and diagnostics data in Sitecore XP on Azure Web Apps

Below are the necessary Application Insights queries which might help you during the troubleshooting sessions of your Sitecore application:

Availability Results:
availabilityResults
| where timestamp > ago(7d)
| summarize avg(toint(success)) * 100 by bin(timestamp, 1h), name
| order by timestamp asc
| render timechart

Get unique users per day past 90 days:
union pageViews,customEvents
| where timestamp > ago(90d)
| summarize Users=dcount(user_Id) by bin(timestamp, 1d)
| render timechart

Get 500 errors in dependencies line graph past 90 days:
dependencies
| where timestamp > ago(90d)
| where resultCode in ("500", "502")
| summarize count() by bin(timestamp, 1d)
| render timechart

Get 404 errors in requests line graph past 90 days:
requests
| where timestamp > ago(90d)
| where client_Type != "Browser"
| where resultCode == 404
| summarize failedCount=sumif(itemCount, success == false) by bin(timestamp, 1d), resultCode
| extend request='Overall'
| render timechart

Get server exceptions line graph past 90 days:
exceptions
| where timestamp > ago(90d)
| where client_Type != "Browser"
| summarize count() by bin(timestamp, 1d)
| render timechart

Get all exceptions bar chart past 90 days:
exceptions
| where timestamp > ago(90d)
| summarize count = sum(itemCount) by bin(timestamp, 4h), problemId, tostring(customDimensions.InstanceName)
| order by timestamp desc
| render barchart

Clientside and react errors line graph past 90 days:
exceptions
| where timestamp > ago(90d)
| where client_Type == "Browser"
| summarize count() by bin(timestamp, 1d)
| render timechart

Get WARN total count line graph past 90 days:
traces
| where timestamp > ago(90d)
| where severityLevel == 2
| parse message with * "WARN" TrimmedMessage
| summarize count() by bin(timestamp, 1d)
| render timechart

Get Trace ERROR total count line graph past 90 days:
traces
| where timestamp > ago(90d)
| where severityLevel == 3
| parse message with * "ERROR" TrimmedMessage
| summarize count() by bin(timestamp, 1d)
| render timechart

Get pageviews line graph past 90 days:
pageViews
| where timestamp > ago(90d)
| summarize count() by bin(timestamp, 1d)
| render timechart

Check your CD(s) for errors:
traces
| where timestamp > ago(1d)
| where message contains "ERROR"
| where (customDimensions).Role contains "CD"
| project timestamp, message, (customDimensions).InstanceName
| order by timestamp desc

To create a better overview on ERRORS you could extend the timespan and render the query using, for example, a timechart.
traces
| where timestamp > ago(144h)
| where message contains "ERROR"
| where (customDimensions).Role contains :CD"
| extend localTime = timestamp + 1h
| summarize Amount_Of_Errors=dcount(message) by bin(localTime, 1h)
| order by localTime asc
| render timechart

Check your CM(s) for errors:
traces
| where timestamp > ago(1d)
| where message contains "ERROR"
| where (customDimensions).Role contains "CM"
| project timestamp, message, (customDimensions).InstanceName
| order by timestamp desc

Check all instances for errors:
traces
| where timestamp > ago(1d)
| extend localTime = timestamp + 1h
| where message contains "ERROR"
| where message !contains "INFO" and message !contains "WARN"
| project localTime, message, (customDimensions).InstanceName
| order by localTime desc

Check your environment on exceptions:
exceptions
| where timestamp > ago(14d)
| extend localTime = timestamp + 1h
| project localTime, (customDimensions).MachineName, assembly, outerMessage

Check your environment on server side exceptions:
exceptions
| where timestamp > ago(7d)
| where client_Type != "Browser"
| summarize Total = count() by problemId
| order by Total
| project Total, problemId
| take 10

Get server exceptions total count:
exceptions
| where timestamp > ago(7d)
| where client_Type != "Browser"
| summarize count()

Get client side exceptions:
exceptions
| where timestamp > ago(7d)
| where client_Type == "Browser"
| summarize Total = count() by problemId
| order by Total
| project Total, problemId
| take 10

Get client side exceptions total count:
exceptions
| where timestamp > ago(7d)
| where client_Type == "Browser"
| summarize count()

Get WARN count by occurrence:
traces
| where timestamp > ago(7d)
| where severityLevel == 2
| parse message with * "WARN" TrimmedMessage
| project TrimmedMessage, customDimensions.Role
| summarize Total = count() by TrimmedMessage, tostring(customDimensions_Role)
| order by Total
| project Total, customDimensions_Role, TrimmedMessage
| take 10

Get WARN total count:
traces
| where timestamp > ago(7d)
| where severityLevel == 2
| parse message with * "WARN" TrimmedMessage
| summarize count()

Get Trace ERROR count by occurrence:
traces
| where timestamp > ago(7d)
| where severityLevel == 3
| parse message with * "ERROR" TrimmedMessage
| project TrimmedMessage, customDimensions.Role
| summarize Total = count() by TrimmedMessage, tostring(customDimensions_Role)
| order by Total
| project Total, customDimensions_Role, TrimmedMessage
| take 10

Get TRACE ERROR total count:
traces
| where timestamp > ago(7d)
| where severityLevel == 3
| parse message with * "ERROR" TrimmedMessage
| summarize count()

Check your environment on log entry’s with severity > 3:
traces |
where severityLevel >= 3

What are the most hit Urls:
requests
| where timestamp > ago(14d)
| summarize count() by url
| order by count_ desc | project url, count_

Give me all 404 status codes:
requests
| where timestamp > ago(14d)
| extend localTime = timestamp + 1h
| where resultCode == "404"
| order by localTime desc

and summarize the Urls including a count
requests
| where timestamp > ago(14d)
| where resultCode == "404"
| summarize count() by url
| order by count_ desc | project url, count_

Check Sitecore license misconfigurations
traces
| where timestamp > ago(7d)
| where message contains "license" and severityLevel > 1

How many unique sessions hit my environment:
pageViews
| where timestamp > ago(7d)
| summarize TotalUniqueSessions = dcount(session_Id) by bin(timestamp, 1d)
| order by timestamp asc
| render barchart kind=default

Top 10 – Most requested pageviews:
pageViews
| where timestamp > ago(7d)
| summarize count() by url
| order by count_ desc | project url, count_
| take 10

Top 10 – Most requested pageviews (combined UA and City):
pageViews
| where timestamp > ago(7d)
| summarize count() by url, client_Browser, client_City, client_CountryOrRegion
| order by count_ desc | project url, count_, client_Browser, client_City, client_CountryOrRegion
| take 10

Top 10 – 404 resultCodes:
requests
| where resultCode == 404
| where timestamp > ago(7d)
| summarize count() by url
| order by count_ desc
| take 10

Top 10 – 500 Errors in dependencies:
dependencies
| where resultCode in ('500', '502')
| where timestamp > ago(7d)
| summarize count() by name, resultCode, target, type
| project name, resultCode, target, type, count_
| order by count_ desc
| take 10

CPU Usage:
performanceCounters
| where timestamp > ago(@{variables('timestamp')})
| where category == 'Processor'
| where counter == '% Processor Time'
| where instance == '_Total'
| summarize avg(value) by bin(timestamp, 1h), cloud_RoleInstance
| order by timestamp asc
| render timechart

Comments

Popular posts from this blog

Comparison between Azure Application Gateway V1 and V2

Microsoft has announced new version of Azure Application Gateway and its Web Application Firewall module (WAF). In this article, we will discuss about the enhancements and new highlights that are available in the new SKUs i.e. Standard_v2 and WAF_v2. Enhancements and new features: Scalability: It allows you to perform scaling of the number of instances on the traffic. Static VIP: The VIP assigned to the Application Gateway can be static which will not change over its lifecycle. Header Rewrite: It allows you to add, remove or update HTTP request and response headers on application gateway. Zone redundancy: It enables application gateway to survive zonal failures which allows increasing the resilience of applications. Improved Performance: Improvement in performance during the provisioning and during the configuration update activities. Cost: V2 SKU may work out to be overall cheaper for you relative to V1 SKU. For more information, refer Microsoft prici

Difference between Azure Front Door Service and Traffic Manager

Azure Front Door Service is Microsoft’s highly available and scalable web application acceleration platform and global HTTP(s) load balancer. Azure Front Door Service supports Dynamic Site Acceleration (DSA), SSL offloading and end to end SSL, Web Application Firewall, cookie-based session affinity, URL path-based routing, free certificates and multiple domain management. In this article, I will compare Azure Front Door to Azure Traffic Manager in terms of performance and functionality. Similarity: Azure Front Door service can be compared to Azure Traffic Manager in a way that this also provides global HTTP load balancing to distribute traffic across different Azure regions, cloud providers or even with your on-premises. Both AFD & Traffic Manager support: Multi-geo redundancy: If one region goes down, traffic routes to the closest region without any intervention. Closest region routing: Traffic is automatically routed to the closest region. Differences: Azu

Install Solr as an Azure App Service

After Sitecore 9.0.2, Solr is a supported search technology for Sitecore Azure PAAS deployments. In this article, we will install SOLR service 8.4.0 in Azure App Service for Sitecore 10. 1. Create Azure App Service Login to Azure and create Azure App service. Make sure Runtime stack should be Java. 2. Download Solr Download Solr 8.4.0 from https://archive.apache.org/dist/lucene/solr/ Extract the files and add the below web.config file in the Solr package. <?xml version="1.0" encoding="UTF-8"?> <configuration>  <system.webServer>      <handlers>      <add  name="httpPlatformHandler"            path="*"            verb="*"            modules="httpPlatformHandler"            resourceType="Unspecified" />    </handlers>    <httpPlatform processPath="%HOME%\site\wwwroot\bin\solr.cmd"        arguments="start -p %HTTP_PLATFORM_PORT%"

Azure Machine Learning public preview announcement //Build, May 2021

Azure service updates Azure Machine Learning public preview announcement //Build, May 2021 New feature: Prebuilt Docker images for Inferencing, now in public preview. Click here for more information.

Export BACPAC file of SQL database

When you need to create an archive of an Azure SQL database, you can export the database schema and data to a BACPAC file. A BACPAC file can be stored in Azure blob storage or in local storage in an on-premises location and later imported back into Azure SQL Database or into a SQL Server on-premises installation. Let's learn some of the ways to export BACPAC file. Export BACPAC using Azure Portal Open your SQL Database and select Export. Fill the parameters as shown below. Select your storage account container & enter your SQL Server admin login. To check the status of your database export. Open your SQL Database server containing the database being exported. Go to Settings and then click Import/Export history Export BACPAC using SSMS Login Azure SQL Database by SSMS. Right-click the database -> Tasks -> Export Data-tier Application Save the .bacpac file into local disk. Export BACPAC using SQLPackage There is a command line tool that you can also choose to