SplunkHttpTarget.Lib 1.0.1

dotnet add package SplunkHttpTarget.Lib --version 1.0.1
                    
NuGet\Install-Package SplunkHttpTarget.Lib -Version 1.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SplunkHttpTarget.Lib" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SplunkHttpTarget.Lib" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="SplunkHttpTarget.Lib" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SplunkHttpTarget.Lib --version 1.0.1
                    
#r "nuget: SplunkHttpTarget.Lib, 1.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SplunkHttpTarget.Lib@1.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SplunkHttpTarget.Lib&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=SplunkHttpTarget.Lib&version=1.0.1
                    
Install as a Cake Tool

SplunkHttpTarget.Lib

A production-ready custom NLog target for Splunk HTTP Event Collector (HEC) with comprehensive multi-targeting support.

Features

  • 🎯 Multi-targeting support: .NET Framework 4.7.2, .NET 6.0, .NET 8.0
  • 🔒 Secure: Uses latest secure versions of all dependencies
  • 🚀 Modern: Built with modern NLog APIs and best practices
  • 📊 Comprehensive: Full support for Splunk HEC features
  • 🔧 Configurable: Extensive configuration options for all environments

Quick Start

Installation

Install-Package SplunkHttpTarget.Lib

or via .NET CLI:

dotnet add package SplunkHttpTarget.Lib

Basic Usage

using NLog;
using NLog.Config;
using SplunkHttpTarget;

// Register the custom target (modern way)
LogManager.Setup().SetupExtensions(s => 
    s.RegisterTarget<SplunkHttpTarget>("SplunkHttp"));

var config = new LoggingConfiguration();

// Create and configure SplunkHttpTarget
var splunkTarget = new SplunkHttpTarget()
{
    Name = "splunk",
    Url = "http://your-splunk-server:8088/services/collector/event",
    HecToken = "your-hec-token-here",
    SourceType = "nlog-custom-target",
    Index = "main",
    ApplicationName = "YourApp",
    ApplicationVersion = "1.0.0",
    Environment = "production"
};

// Add target and rule
config.AddTarget(splunkTarget);
config.AddRuleForAllLevels(splunkTarget);

LogManager.Configuration = config;

// Use logger
var logger = LogManager.GetCurrentClassLogger();
logger.Info("Hello Splunk!");

Configuration via NLog.config

<?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">
  
  <extensions>
    <add assembly="SplunkHttpTarget.Lib" />
  </extensions>
  
  <targets>
    <target xsi:type="SplunkHttp" 
            name="splunk"
            url="http://your-splunk-server:8088/services/collector/event"
            hecToken="your-hec-token-here"
            sourceType="nlog-custom-target"
            index="main"
            applicationName="YourApp"
            applicationVersion="1.0.0"
            environment="production" />
  </targets>
  
  <rules>
    <logger name="*" minlevel="Info" writeTo="splunk" />
  </rules>
  
</nlog>

Configuration Properties

Property Description Required Default
Url Splunk HEC endpoint URL ✅ Yes -
HecToken HEC authentication token ✅ Yes -
SourceType Splunk source type No nlog
Index Splunk index name No main
ApplicationName Your application name No -
ApplicationVersion Your application version No -
Environment Environment name (dev/test/prod) No -

Compatibility

  • .NET Framework 4.7.2+: Full support with packages.config or PackageReference
  • .NET 6.0+: Full support with modern .NET features
  • .NET 8.0+: Optimized performance with latest runtime features

Dependencies

  • NLog: 6.0.1+ (compatible across all target frameworks)
  • System.Text.Json: 9.0.7+ (secure, high-performance JSON serialization)

Security

This package uses only secure, up-to-date dependencies and follows security best practices:

  • No vulnerable package versions
  • Secure HTTP communication
  • Proper input validation and sanitization

License

MIT License - see GitHub repository for details.

Support

For issues, feature requests, or contributions, please visit the GitHub repository.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Framework net472 is compatible.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.1 212 7/9/2025

Multi-targeting support for .NET Framework 4.7.2, .NET 6.0, and .NET 8.0. Updated to use modern NLog APIs and secure dependencies.