Azure Quick Tasks -Enabling Azure Diagnostics via Configuration

As my customers started moving to Azure PaaS, I started getting a lot of questions about enabling logging and tracing in Azure. So usual way to enable and trace out of Azure PaaS currently is provided via WAD (Windows Azure Diagnostics).  There are lots of articles on this subject, goal here is to show you how to quickly enable this feature via diagnostics.wadcfg, i.e. via configuration.

Assuming you are working in Visual Studio, in your solution just right click on WebRole or Worker Role you are working with and pick properties that would open where you can turn on logging (it will enable it in config)

clip_image001

That underneath writes a file called diagnostics.wadcfg with configuration. This is what I have in my example in it:

<?xml version=”1.0″ encoding=”utf-8″?>
<DiagnosticMonitorConfiguration configurationChangePollInterval=”PT1M” overallQuotaInMB=”4096″ xmlns=”
http://schemas.microsoft.com/ServiceHosting/2010/10/DiagnosticsConfiguration”>
<DiagnosticInfrastructureLogs />
<Directories>
<IISLogs container=”wad-iis-logfiles” />
<CrashDumps container=”wad-crash-dumps” />
</Directories>
<Logs bufferQuotaInMB=”1024″ scheduledTransferPeriod=”PT1M” scheduledTransferLogLevelFilter=”Verbose” />
<WindowsEventLog bufferQuotaInMB=”1024″ scheduledTransferPeriod=”PT1M” scheduledTransferLogLevelFilter=”Verbose”>
<DataSource name=”Application!*” />
</WindowsEventLog>
<PerformanceCounters bufferQuotaInMB=”512″ scheduledTransferPeriod=”PT0M”>
<PerformanceCounterConfiguration counterSpecifier=”\Memory\Available MBytes” sampleRate=”PT3M” />
<PerformanceCounterConfiguration counterSpecifier=”\Web Service(_Total)\ISAPI Extension Requests/sec” sampleRate=”PT3M” />
<PerformanceCounterConfiguration counterSpecifier=”\Web Service(_Total)\Bytes Total/Sec” sampleRate=”PT3M” />
<PerformanceCounterConfiguration counterSpecifier=”\ASP.NET Applications(__Total__)\Requests/Sec” sampleRate=”PT3M” />
<PerformanceCounterConfiguration counterSpecifier=”\ASP.NET Applications(__Total__)\Errors Total/Sec” sampleRate=”PT3M” />
<PerformanceCounterConfiguration counterSpecifier=”\ASP.NET\Requests Queued” sampleRate=”PT3M” />
<PerformanceCounterConfiguration counterSpecifier=”\ASP.NET\Requests Rejected” sampleRate=”PT3M” />
</PerformanceCounters>
</DiagnosticMonitorConfiguration>

Note above that I am picking up certain perfmon counters, event logs , IIS logs and even crash dumps.  That is setting in Diagnostics area in Config screen above.

This is what I have in my in my app.config, meaning there is a Listener entry:

<system.diagnostics>

<trace>

<listeners>

<add type=”Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=2.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″

name=”AzureDiagnostics”>

<filter type=”” />

</add>

</listeners>

</trace>

</system.diagnostics>

If you have configured Diagnostics as per screen above you will note that it automatically will create WadLogs table for you where traces will go.

clip_image002

WAD automatically maps the wad-crash-dumps, wad-frq, and wad-iis containers to special folders which only exist in web and worker roles.  For VM roles comment out the CrashDumps, FailedRequestLogs, and IISLogs elements.

Finally, there are the various “QuotaInMB” settings.  WAD automatically allocates 4096 MB of local storage named DiagnosticStore.  WAD fails if the overallQuotaInMB value is set higher than the local storage allocated or if the various “QuotaInMB” values add up to within about 750 MB of overallQuotaInMB.  Either:

  • Decrease some of the “QuotaInMB” values until the config works.

or

  • Add a LocalStorage setting named DiagnosticStore to ServiceDefinition.csdef and increase overallQuotaInMB.

For more I recommend – http://www.davidaiken.com/2012/02/27/how-to-use-diagnostics-wadcfg-to-configure-windows-azure-diagnostics-collection/, http://blogs.msdn.com/b/davidhardin/archive/2011/02/26/wad-is-built-on-etw.aspx

Hope this was useful.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s