willvv
willvv

Reputation: 8639

Save EventLog entries to Windows Azure Storage

I have an application that uses the System.Diagnostics.Trace and System.Diagnostics.EventLog classes to generate the logging information of the application.

I know that it is possible to configure an Azure role to automatically save the information stored by System.Diagnostics.Trace into Azure Storage.

I want to know if there is something I can do to get the same behavior with the System.Diagnostics.EventLog (change some configuration in the Azure role and have the EventLog data stored to Azure Storage).

Regards

Upvotes: 1

Views: 807

Answers (2)

Stuart
Stuart

Reputation: 66882

For diagnostics trace, you need to:

  • use the diagnostics trace listener Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener in your web.config
  • ensure that your Logs.ScheduledTransferPeriod is setup

For event log tracing, you need to configure the diagnostics to trace the Application event logs:

config.WindowsEventLog.DataSources.Add(“Application!*”);
// can also add System if you want to: config.WindowsEventLog.DataSources.Add(“System!*”);
config.WindowsEventLog.ScheduledTransferPeriod = TimeSpan.FromMinutes(5);

For full instructions see http://blog.bareweb.eu/2011/01/beginning-azure-diagnostics/

Upvotes: 1

dunnry
dunnry

Reputation: 6868

Actually, nothing is automatically saved in storage. The information is buffered into the role on disk and then transferred (on demand or scheduled) to storage. So, you can definitely do the same thing with EventLogs. You just use them like normal, configure Diagnostics to monitor them and occasionally transfer to storage. Use the Windows Azure MMC for a free tool to do this easily.

Upvotes: 0

Related Questions