开发者

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 automa开发者_运维技巧tically 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


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/


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜