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

  • Description

    Sitecore XP comes with full Azure PaaS support starting from the 8.2 Update-1 release. This includes support of Azure Web Apps for hosting Sitecore applications.

    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.

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

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

  • 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 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 13, 2017

Keywords: 

  • Azure
  • ,
  • CMS