How to access Sitecore logs from Azure

Once our website is live and hosted on Azure PaaS, we don’t have access to it’s files and folders like we have on On-prem setup. So how do we get the Sitecore logs from Azure WebApps?

There are couple of approaches to access the logs namely FTP, Azuretools.aspx, Azure Application Insights, etc. You can go through the KB article from Sitecore.

For FTP, we already have a blog, you can refer it here.

In this blog, we will see how to use Azuretools.aspx page to access the logs from Azure. The prerequisites for this activity is, you need a Sitecore site hosted on Azure and also one Sitecore instance available on your local machine.

Steps to access the log files assuming you have a prerequisites in place:

  1. Download the latest version of the AzureTools.aspx page.
  2. Extract the downloaded folder.
    Extracted File
  3. There will be Azuretools.aspx file under sitecore/admin/ folder.
  4. Copy the file.
  5. Go to your local sitecore instance – (C:\inetpub\wwwroot\SitecoreDemo.dev.local\sitecore\admin) and paste the file.
  6. Login to the local sitecore instance and access the aspx file. (http://sitecoredemo.dev.local/sitecore/admin/azuretools.aspx)
    Azure Tool
  7. Click on the App Insights button.
    Azure Tool1
  8. Now to make the request to the Azure PaaS instance to fetch the logs, we will need Application ID and API Key.
  9. Go to Azure Portal >> Resource Group.
    Resource Group
  10. Click on Application Insights of the Sitecore instance.
    Application Insights
  11. Under Configure section on Left side bar >> API Access
    Application Insights1
  12. Note down the Application ID from the Text box. Click on Create API Key button.
    Application Insights2
  13. Create an API key (Read telemetry), click on Generate and Save its value.
    Note: When the key creation dialog is closed, you cannot access the key value.
    Application Insights3
  14. Click on Generate key. And copy the value on notepad.
    Application Insights4
  15. Now, we have noted down Application ID and API Key. Lets move to our local sitecore instance site where the Azuretools.aspx page is open.
  16. Enter both the values in the Azuretools.aspx page.
    Azure Tool2
  17. Once we enter these values, scroll down and click on Use Default roles button.
  18. Lets assume that we need logs from CM site, so check CM checkbox.
    Azure Tool3
  19. Click on Download Logs to download the log files.
    Azure Tool4

There is also an option for Extended View where you can set the date range, type of logs required, etc. In this way we can access the sitecore logs from Azure WebApps.

Thank you.. Keep Learning.. Keep Sitecoring.. 🙂

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s