Search code examples
.netazureazure-worker-rolesazure-application-insights

Cloud Service Application Insights ETW issues


I'm attempting to get my Azure Worker Role's logs appearing inside Application Insights. When I run Get-AzureServiceDiagnosticsExtension I get the following...

<PublicConfig
xmlns="http://schemas.microsoft.com/ServiceHosting/2010/10/DiagnosticsConfiguration">
  <WadCfg>
    <DiagnosticMonitorConfiguration overallQuotaInMB="8192" sinks="applicationInsights.errors">
      <DiagnosticInfrastructureLogs scheduledTransferLogLevelFilter="Verbose" />
      <PerformanceCounters scheduledTransferPeriod="PT1M">
        <PerformanceCounterConfiguration counterSpecifier="\Memory\Available MBytes"
sampleRate="PT3M" />
        <PerformanceCounterConfiguration counterSpecifier="\Processor(_Total)\% Processor Time"
sampleRate="PT3M" />
      </PerformanceCounters>
      <WindowsEventLog scheduledTransferPeriod="PT1M">
        <DataSource name="Application!*[System[(Level=1 or Level=2 or Level=3)]]" />
        <DataSource name="Windows Azure!*[System[(Level=1 or Level=2 or Level=3 or Level=4)]]" />
      </WindowsEventLog>
      <EtwProviders sinks="applicationInsights" />
      <CrashDumps dumpType="Full">
        <CrashDumpConfiguration processName="WaAppAgent.exe" />
        <CrashDumpConfiguration processName="WindowsAzureGuestAgent.exe" />
        <CrashDumpConfiguration processName="WaWorkerHost.exe" />
        <CrashDumpConfiguration processName="DiagnosticsAgent.exe" />
      </CrashDumps>
      <Logs scheduledTransferPeriod="PT1M" scheduledTransferLogLevelFilter="Verbose" />
      <Metrics resourceId="/subscriptions/{My_Subscription_GUID}/resourceGroups/Group/providers/Microsoft.ClassicCompute/domainNames/MyCloudServiceName" />
    </DiagnosticMonitorConfiguration>
    <SinksConfig>
      <Sink name="applicationInsights">
        <ApplicationInsights />
        <Channels>
          <Channel logLevel="Verbose" name="errors" />
        </Channels>
      </Sink>
    </SinksConfig>
  </WadCfg>
  <StorageAccount>myclassicstorage</StorageAccount>
</PublicConfig>

The following is from the original diagnostics.wadcfgx file uploaded using Set-AzureServiceDiagnosticsExtension

<PrivateConfig xmlns="http://schemas.microsoft.com/ServiceHosting/2010/10/DiagnosticsConfiguration">
    <StorageAccount name="{myclassicstorage}" key="{MyClassicStorageKey}" endpoint="https://myclassicstorage.blob.core.windows.net/" />
</PrivateConfig>

Using Azure Storage Explorer I can connect to myclassicstorage and I can see the entries I desire inside WADLogsTable yet when I go to Application Insights, nothing...

enter image description here

So it seems like my trace entries are making it into storage, but my Application Insights isn't picking up the data from the storage.

Anyhow questions, the answers to which might result in an explanation for the failure:-

  1. Does it matter whether you choose a "Storage Account" or a "Storage Account (classic)" ?

  2. There's a Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString in the ServiceConfiguration.Local.cscfg and the ServiceConfiguration.Cloud.cscfg plus the StorageAccount in the diagnostics.wadcfgx file. Why are there 3 places in which to set storage and what should you put in these (I have set the same details).

  3. In many examples the StorageAccount in the diagnostics.wadcfgx file has the endpoint set to https://core.windows.net what should it be set to?


Solution

  • Well it just started working. I believe the answer was to change the EtwProviders configuration as follows...

    <EtwProviders>
      <EtwEventSourceProviderConfiguration provider="WaWorkerHost.exe">
        <DefaultEvents />
      </EtwEventSourceProviderConfiguration>
    </EtwProviders>
    

    I got "WaWorkerHost.exe" from looking at the data posted to the WADLogsTable

    EventName="MessageEvent" Message="2016-06-01 03:17:50,924 [14] INFO myservice.TaskProcessing [(null)] - Core Completed - Next due date 2016-06-01T03:18:27.5430000 " TraceSource="WaWorkerHost.exe"