Skip to content

Latest commit

 

History

History
56 lines (46 loc) · 2.13 KB

File metadata and controls

56 lines (46 loc) · 2.13 KB

(NOTE: NOT ACTIVELY SUPPORTED) NLog Target for Azure Event Hub - DAS.SFA.NLog.Targets.AzureEventHub

A custom NLog target that pushes log events to Azure Event Hub.

The Event Hub target works best with the BufferingWrapper or AsyncWrapper targets applied.

Configuration Syntax

Add the following to your NLog.config file to reference the EventHub target assembly:

<extensions>
    <add assembly="SFA.DAS.NLog.Targets.AzureEventHub"/>
</extensions>

The target has the following configuration format:

<targets>
  <target xsi:type="AzureEventHub"
          name="String"
          appName="String"
          layout="Layout"
          eventHubConnectionStringKey="String"
          eventHubNameKey="String">
  </target>
</targets>

Parameters

  • name - Name of the target. String
  • appName - Name of the application. Added as property to the log event. String
  • layout - (Optional) Layout that should be used to calculate the value for the message field. Layout
  • eventHubConnectionString - Azure Event Hub connection string. String
  • eventHubName - Event Hub Name. String
  • eventHubConnectionStringKey The app setting key that should be used to for the Connection string String eventHubNameKey - The app setting key that should be used for the Event Hub Name. String

Example

<appSettings>
	<add key="EventHubName" value="Event hub name"/>
	<add key="EventHubConnectionString" value="Endpoint=sb://test.servicebus.windows.net/;SharedAccessKeyName=<sas name>;SharedAccessKey=<sas key>;TransportType=Amqp"/>
</appSettings>

<targets>
  <target xsi:type="AzureEventHub"
          name="eventHubLogger"
          appName="MyTestApplication"
          layout="${message}"
          eventHubConnectionStringKey="EventHubConnectionString"
          eventHubNameKey="EventHubName">
  </target>
</targets>