Access logs and diagnostics data in Sitecore XP on Azure Web Apps

  • Description

    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 than 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.

  • Accessing Sitecore Logs

    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:

    1. Go to Azure Portal (https://portal.azure.com).
    2. Select the specific Application Insights object related to Sitecore XP deployment.
    3. In the Overview section, click the Analytics tab at the top of the page.
    4. On the AppInsights Analytics Portal page, create a new tab and enter the relevant query to the Sitecore logs storage (for a single instance in the environment):
      traces
      | where customDimensions contains "<CloudRole>-<WebApp>"
      | where timestamp > now(-14d)
      | project timestamp, message
      | sort by timestamp desc
      • WebApp — name of Web Application 
      • 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.

        Note: You can use the following query to determine the "CloudRole" value for the needed instance (CM, CD, Processing, Reporting, Single):

        traces
        | 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

    After logs are retrieved, you can export them to a CSV file.

    For more details about writing custom queries, use the analytics query reference from Microsoft Azure documentation.

  • Accessing Sitecore Configs and other files via FTP

    To access deployed application files and configuration data, Azure Web Apps provide full FTP access. To enable FTP access and browse useful data:

    1. Enable the FTP credentials for the Sitecore XP instance:
      • Go to Azure Portal (https://portal.azure.com).
      • Select a particular Web App.
      • Navigate to the Deployment Credentials section.
      • Enable an FTP user with admin access.
    2. Use any FTP client (for example, FileZilla) and connect to the Web App's FTP endpoint using the credentials created before. The endpoint can be retrieved in Azure Portal by selecting a particular Web App and finding the FTP hostname parameter in the Overview section.

    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.

Applies to:

CMS 8.2 Update-1+

January 10, 2017
January 23, 2018

Keywords: 

  • Azure
  • ,
  • CMS