Skip to content

Custom target for pushing logs by NLog to Splunk

License

Notifications You must be signed in to change notification settings

valeev/NLog.Splunk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NLog.Splunk.Simple

NLog target for sending logs to splunk by /receivers/simple

NuGet license


Getting Started

Use the GUI or the following command in the Package Manager Console

Install-Package NLog.Splunk.Simple

Not necessary but sometimes you have to register custom target, try to register it in Global.asax with a next code

ConfigurationItemFactory.Default.Targets.RegisterDefinition("SplunkSimple", typeof(SplunkSimple));

Configuration

<target type="SplunkSimple" name="SplunkRestInfo" host="{SPLUNK_SERVER_URL}" username="{USERNAME}" password="{PASSWORD}"
          source="{SOURCE_IN_SPLUNK}" sourceType="{SOURCE_TYPE}"
          layout="${longdate}|${level:uppercase=true}|${logger}|${message} ${exception:format=tostring}">
</target>

Don't forget to add your rule

<logger name="*" writeTo="SplunkRestInfo" minLevel="Info" />

How to create custom target for NLog: https://github.com/nlog/nlog/wiki/How-to-write-a-custom-target

Releases

No releases published

Packages

No packages published

Languages