Skip to content
July 19, 2021 / kiranpatils

Identify current Sitecore log file on Azure PaaS scaled instance

Challenge

Sitecore log file is the first place to check to troubleshoot any Sitecore issue. But in the Azure PaaS world, it got a complicated little bit and there are few places to check log files. But things get more complicated when you are checking log files on the PROD instance, where the CD site has been scaled to multiple instances.

Solution

Before I share specific steps, I strongly recommend to read following posts as those already covers basics of Logging in Azure PaaS world!

As per above posts, Sitecore records log information using Application Insights as well as Physical log file. When to check what?

  • AI logs are aggregated logs. So, I use AI Logs when I need to see some historical patterns in the log file. But I never use AI Logs when I have to check some real-time issue, for example, When I request a page and component is failing, then. I will use the Sitecore Physical log file as it should give me real-time information.

But when you go to App_Data/logs folder using App Editor/KUDU for your CD App (Assuming that it has been scaled) it lists lot of folders, which is super confusing:

Let me simplify it for you!

Note : I’m using Sitecore 9.3 version for current steps. But it should be relevant for your version.

  • To identify which server your request is going. Open your website URL and select Dev tools and inspect Arr-affinity Cookie value. In our case it is “12b516ccd2f566cee79bc5696794714b568bb8e3ad14b7bb7f24a054ba7a15ae”
  • Open KUDU Console and select Instance “12b5” (This is also known as Short Instance ID – It is first 4 letters of your ARR Affinity cookie value)
  • Click on “Environment” and here you should double check value of an Instance Id, it should be same as your ARR Affinity cookie value. Once you verify that, please take a note of Machine name value in this case “pd0mdwk00000N
  • Now, go back to your App_Data/logs folder
  • Scroll to bottom and you should be able to locate latest file!

In Summary, Sitecore uses Machine name value to create a folder for each scaled instance and stores log files inside that folder, As per the nature of Azure PaaS it keeps rotating those Instances and that’s why you see a lot of those folders in your logs folder.

Hope this helps you to identify correct log file and you can resolve issue quickly and go home!

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

%d bloggers like this: