Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to access event log from window azure

I would like to fetch window event logs from Azure webrole's instance. when i connect to RDP of instance then by Event viewer i am able to see Window Event Logs of "Application" & "Error" type. Is there any way to directly access that logs using API or something else or i need to use Diagnostic to enable that log data to transfer in to storage and from there i can access?

like image 973
Arun Rana Avatar asked Oct 07 '22 18:10

Arun Rana


1 Answers

IF you want to directly access the Azure VM Event logs, the best option is to use use Azure Diagnostics and Azure Cmdlets to access Event Log details. In my understand this one is very easy to setup and once you have access to Event logs, you can download and save it to your local machine. The method is described as below:

http://michaelwasham.com/2011/09/20/windows-event-logs-with-windows-azure-diagnostics-and-powershell/

There is another simple method is that you can create an ASP page and use Event Log API to simply access the event log directly on your web role and customize it the way you would want to see. You can find several examples on net on how to do it i.e. this one. This is a very simple way to get what you are looking for and the only drawback to this approach is that the ASP page will be available on website, unless you find some ways to protect it.

Although you can use any of the above method, setting up Windows Azure Diagnostics to collect Event log from the machine and send to Windows Azure Storage, is best and preferred method. The steps are described here, in case you don't know:

https://msdn.microsoft.com/en-us/library/windows/desktop/bb427443(v=vs.85).aspx

Any other method to collect these logs (using Azure Connect and Remoting etc) would be complex and troublesome.

like image 68
AvkashChauhan Avatar answered Oct 10 '22 08:10

AvkashChauhan