Sitecore XP fully supports Azure PaaS from the 8.2 Update-1 release. This includes support of Azure Web Apps for hosting Sitecore applications.
You access Sitecore XP logs and diagnostics information on Azure Web Apps differently from how you do in an on-premise solution. 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.
There are several options to collect Sitecore XP logs from Azure Application Insights (AI):
-
For Sitecore XP 8.2.1 and later, you can use Azure Application Insights REST API:
To utilize this approach, use the latest version of the AzureTools.aspx page with the following two Azure AI parameters:
To retrieve these parameters, proceed as follows, and for more details on Application Insights keys refer to Microsoft documentation.
- Locate the following tab in the related resource group: Azure Portal -> Resource Group -> Application Insights -> Configure section -> API Access.
- Retrieve the Application ID from this tab.
- On the same tab, create an API key (Read telemetry) and save its value.
Note: When the key creation dialog is closed, you cannot access the key value.
To collect logs use this page:
- Open the page using one of the following approaches:
- Sitecore XP (website/sitecore/admin/AzureTools.aspx)
- http://localhost/AzureTools.aspx (C:\inetpub\wwwroot\AzureTools.aspx, only with IIS configured to use ASP.NET)
- Select the Logs tab and enter Application ID and API key values.
- Click Find existing roles to look for roles (CM, CD, and so on) in the environment.
- Select the roles you need and logs recency.
- Optionally, you can select the Extended checkbox to see more options.
- Click Download logs to download related logs, which are compatible with the Sitecore Log Analyzer.
For logs analysis, you can use Azure AI parameters to download the required logs, or you can provide these parameters to Sitecore Support.
If access to Azure AI logs is no longer needed, the API key can be deleted (Azure Portal -> Right-click on the API key -> Delete).
-
Using Application Insights of the Azure Portal
To access enhanced logging data of a Sitecore XP instance deployed to Azure Web Apps, we recommend you browse preconfigured Application Insights records using the Application Insights Logs page:
- Go to the Azure Portal (https://portal.azure.com).
- Open the related resource group and select Application Insights.
- In the Overview section, click the Logs button at the top of the page.
- On the opened page, paste and run the needed query to retrieve logs. In the following example, logs for the last 14 days from a Single Sitecore XP role are retrieved.
traces
| where tostring(customDimensions.Role) == "Single"
| where timestamp > now(-14d)
| project timestamp, message
| sort by timestamp desc
- The following roles can be used for the query above: Single, CM, CD, Processing, Reporting, DDS.
- To see all available fields for logs filtering (like customDimensions.InstanceName or severityLevel), you can run the following simple query:
traces
After the logs have been retrieved, they can be exported to a CSV file.
For more details about writing custom queries, consider reading the Kusto queries articles.
To access the deployed application files and configuration data, Azure Web Apps provides full FTP access. For browsing the needed data:
- Extract FTP credentials for the needed Sitecore XP instance:
- Go to the Azure Portal (https://portal.azure.com).
- Select a particular Web app.
- Download a file with credentials by clicking the Get publish profile button at the top of the Overview tab.
- Extract FTP credentials:
- publishUrl="ftp://host-name-here/site/wwwroot"
- userName="user-name-here"
- userPWD="password-here"
- Using any FTP client (for example, FileZilla), connect to the FTP endpoint using the extracted credentials.
After connecting to the FTP, you can browse the following:
- /LogFiles — access to various diagnostics information including the EventLog from the system running the Azure Web App.
- /site/wwwroot — deployed Sitecore application root folder, with all configs and binaries.