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:
- Download the latest version of the AzureTools.aspx page.
- Extract the downloaded folder.
- There will be Azuretools.aspx file under sitecore/admin/ folder.
- Copy the file.
- Go to your local sitecore instance – (C:\inetpub\wwwroot\SitecoreDemo.dev.local\sitecore\admin) and paste the file.
- Login to the local sitecore instance and access the aspx file. (http://sitecoredemo.dev.local/sitecore/admin/azuretools.aspx)
- Click on the App Insights button.
- Now to make the request to the Azure PaaS instance to fetch the logs, we will need Application ID and API Key.
- Go to Azure Portal >> Resource Group.
- Click on Application Insights of the Sitecore instance.
- Under Configure section on Left side bar >> API Access
- Note down the Application ID from the Text box. Click on Create API Key button.
- 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.
- Click on Generate key. And copy the value on notepad.
- 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.
- Enter both the values in the Azuretools.aspx page.
- Once we enter these values, scroll down and click on Use Default roles button.
- Lets assume that we need logs from CM site, so check CM checkbox.
- Click on Download Logs to download the log files.
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.. 🙂