0

Given an Azure AppService deployment, running a WebAPI application that has scaled out to 6 instances.

Our WebAPI application writes diagnostic logs using NLog and a File appender. Is there a way to inspect these log files via the Azure Portal or Kudu?

I note that Kudu can access the file system in a sandbox ... but when the application has scaled out to 6 instances it appears that the sandbox is only viewing the 1st instance.

Is there any way to access the log files on any of the other 5 instances?

Howard Hoffman
  • 897
  • 1
  • 9
  • 22
  • Actually App Service uses a shared storage for files so all instances should see essentially the same storage. Are you sure the other instances are writing files that you can't see? – juunas Feb 09 '17 at 14:51
  • I know that the code emits log files to a "logs' subfolder sibling to the bin folder. I see content in it -- and it's growing as we make API requests -- good correlation. Are you saying that the "one" file I'm reading from (e.g. downloaded from Kudu/DebugConsole) is actually a file that contains unified content from all 6 instances? – Howard Hoffman Feb 09 '17 at 17:01

2 Answers2

1

Is there any way to access the log files on any of the other 5 instances?

Log files path is shared for all instances. For more details, please refer to Azure WebApp SandBox and Azure WebApp File Access.

Every Azure Web App has a home directory stored/backed by Azure Storage. This network share is where applications store their content. The home directory is shared among all instances so that all instances see the same directory

Tom Sun - MSFT
  • 24,161
  • 3
  • 30
  • 47
  • This is right. What's also cool is that if I add an NLog `logger` that's connected to `System.Diagnostics.Trace` (e.g. ``) I can see my NLog logging output into the Log Stream. I see log messages from all machines in the one log stream. – Howard Hoffman Feb 13 '17 at 16:26
1

We moved away from NLog for this exact reason. Azure has native support for logging to Azure storage using native .Net Trace, you will have all the logs stored on storage per instance.

If you really want NLog to stay, you can configure the log names to include ${machinename} or processid

albattran
  • 1,887
  • 1
  • 12
  • 16