/nlog-influx-target

nlog target for influxdb2

Primary LanguageC#

nlog-influx-target

NLog logging target for InfluxDB v2.

Nuget GitHub issues Nuget GitHub forks GitHub stars

Supported frameworks

.NET Core (NLog.Extensions.Logging package)
.NET Standard 2.x+ - NLog 4.5

Getting Started

Step 1: Install NLog.Targets.InfluxDB package from nuget.org

Install via Package-Manager   Install-Package NLog.Targets.InfluxDB
Install via .NET CLI          dotnet add package NLog.Targets.InfluxDB

Step 2: Configure nlog sections

<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      autoReload="true">
  <extensions>
		<add assembly="NLog.Targets.InfluxDB"/>
	</extensions>

	<targets>
		<target xsi:type="InfluxDB"
				name="influx"
				Host="https://yourinfluxhost.com"
				Bucket="MyBucket"
				Token="inFluXApi=K3y"
				Org="Organisation"/>
	</targets>
	<rules>
		<logger name="*" minlevel="Trace" writeTo="influx" />
	</rules>
</nlog>
Param Name Variable Type Requirement Description
Host :string yes InfluxDB Host
Bucket :string yes InfluxDB Bucket
Token :string yes InfluxDB API Token
Org :string yes InfluxDB Organisation

Example Project

There is an example WPF application project NLog.Targets.InfluxDB.Demo in the repo which demonstrates usage.