Accessing Sitecore XP logs and diagnostics information on Azure Web Apps differs from the on-premise approach. This article explains how to collect basic Sitecore diagnostics information, such as logs and configuration data, for a Sitecore XP solution deployed to Azure Web Apps.
To access enhanced logging data of a Sitecore XP instance deployed to Azure Web Apps, it is recommended to browse preconfigured AppInsights records using AppInsights Analytics Portal:
Go to Azure Portal (https://portal.azure.com).
Select the specific Application Insights object related to Sitecore XP deployment.
- In the Overview section, click the Analytics tab at the top of the page.
On the AppInsights Analytics Portal page, create a new tab and enter the relevant query to the Sitecore logs storage:
| where cloud_RoleInstance == 'CloudRole'
| where timestamp > now(-14d)
| project timestamp, message
| sort by timestamp desc
The "CloudRole" value for the needed instance (CM, CD, Processing, Reporting, Single) can be determined using the following query:
| extend scinstancename=parsejson(customDimensions).InstanceName
| where timestamp > now(-1d)
| summarize count(), any(tostring(scinstancename)) by cloud_RoleInstance
| extend InstanceName=any_scinstancename
| extend CloudRole=cloud_RoleInstance
| project InstanceName, CloudRole
| order by InstanceName asc
InstanceName — a self-descriptive name of a solution
CloudRole — a name of a cloud role. Each scaled-out instance is associated with several cloud roles containing their own logs.
After logs are retrieved, they can by exported to a CSV file.
For more details about writing custom queries, use the analytics query reference from Microsoft Azure documentation.
More informations you can find at:
Is possible to Enable logstream on Azure app service.