0

I would like to consume log stream data programatically and perform some action.

Are there any APIs for achieving this ?

user155489
  • 143
  • 12

1 Answers1

1

As far as I know, azure Diagnostic information stored to the web app file system can be accessed directly using FTP.

It can also be downloaded as a Zip archive using Azure PowerShell or the Azure Command-Line Interface.

The path is as below:

  • Application logs - /LogFiles/Application/. This folder contains one or more -text files containing information produced by application logging.
  • Failed Request Traces - /LogFiles/W3SVC#########/. This folder contains an XSL file and one or more XML files. Ensure that you download the XSL file into the same directory as the XML file(s) because the XSL file provides functionality for formatting and filtering the contents of the XML file(s) when viewed in Internet Explorer.
  • Detailed Error Logs - /LogFiles/DetailedErrors/. This folder contains one or more .htm files that provide extensive information for any HTTP errors that have occurred.
  • Web Server Logs - /LogFiles/http/RawLogs. This folder contains one or more text files formatted using the W3C extended log file format.
  • Deployment logs - /LogFiles/Git. This folder contains logs generated by the internal deployment processes used by Azure web apps, as well as logs for Git deployments.

The log stream also read the log from the LogFiles folder(D:\home\LogFiles\ ).

So if you want to get the logs programatically, you need firstly download the logs by ftp or command-line.

Besides, if you want to steam logs in local, I suggest you could consider using C# run powershell script.Because, azure powershell SDK has command to stream logging information.About how to call powershell script, you could refer to this question.

Get-AzureWebSiteLog -Name webappname -Tail

To get a list of your web apps run the following command:

Get-AzureWebsite

If you're using 'Slot deployment' you must use the fully qualified name (in quotes):

Get-AzureWebSiteLog -Name "webappname(Staging)" -Tail

More details about how to download or stream logs, you could refer to this article.

Simon_Weaver
  • 140,023
  • 84
  • 646
  • 689
Brando Zhang
  • 22,586
  • 6
  • 37
  • 65