Skip to content

Commit

Permalink
3.0.0 Release
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanBarber committed Feb 20, 2021
1 parent 39a4e32 commit 6597705
Show file tree
Hide file tree
Showing 8 changed files with 463 additions and 357 deletions.
Empty file removed docs/README.md
Empty file.
Binary file added releases/NLog.Targets.Splunk.3.0.0.nupkg
Binary file not shown.
Binary file added releases/NLog.Targets.Splunk.3.0.0.symbols.nupkg
Binary file not shown.
14 changes: 13 additions & 1 deletion src/NLog.Targets.Splunk.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,18 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NLog.Targets.Splunk", "NLog
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleTestApp", "ConsoleTestApp\ConsoleTestApp.csproj", "{1FC3A684-B53E-4010-A6EE-FE2A137F2CA2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NLog.Targets.Splunk.Tests", "NLog.Targets.Splunk.Tests\NLog.Targets.Splunk.Tests.csproj", "{4D322CDC-932F-4DB5-B608-B868DDA452CC}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NLog.Targets.Splunk.Tests", "NLog.Targets.Splunk.Tests\NLog.Targets.Splunk.Tests.csproj", "{4D322CDC-932F-4DB5-B608-B868DDA452CC}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AspNetCoreWebApp", "AspNetCoreWebApp\AspNetCoreWebApp.csproj", "{BA3CA56B-18B4-43F9-A15D-1F79796515D9}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "BuildFiles", "BuildFiles", "{50C33E7F-7A6D-4FB7-8F9F-1E46B506CB3D}"
ProjectSection(SolutionItems) = preProject
build-nuget-packages.cmd = build-nuget-packages.cmd
build-nuget-packages.ps1 = build-nuget-packages.ps1
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test Applications", "Test Applications", "{ED979648-978F-4F12-AB23-215A5DC83B15}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -37,6 +45,10 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{1FC3A684-B53E-4010-A6EE-FE2A137F2CA2} = {ED979648-978F-4F12-AB23-215A5DC83B15}
{BA3CA56B-18B4-43F9-A15D-1F79796515D9} = {ED979648-978F-4F12-AB23-215A5DC83B15}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {1352023C-12FA-4D5B-92BB-3027501BF536}
EndGlobalSection
Expand Down
87 changes: 63 additions & 24 deletions src/NLog.Targets.Splunk/NLog.Targets.Splunk.csproj
Original file line number Diff line number Diff line change
@@ -1,63 +1,102 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net45;net472;netstandard2.0</TargetFrameworks>
<TargetFrameworks>net45;net462;net472;net48;netstandard2.0;netstandard2.1;netcoreapp3.1;net5.0</TargetFrameworks>
<Title>NLog.Targets.Splunk</Title>
<Description>A NLog target for Splunk's Http Event Collector (HEC) Sender</Description>
<Authors>Alan Barber</Authors>
<CurrentYear>$([System.DateTime]::Now.ToString(yyyy))</CurrentYear>
<Copyright>Copyright (c) $(CurrentYear) Alan Barber, Copyright 2013-2015 Splunk, Inc. </Copyright>
<Copyright>Copyright (c) 2017-$(CurrentYear) Alan Barber, Copyright 2013-2015 Splunk, Inc. </Copyright>
<PackageTags>nlog;nlog-target;splunk;splunk-enterprise;logging</PackageTags>
<PackageIconUrl>https://raw.githubusercontent.com/AlanBarber/NLog.Targets.Splunk/master/docs/nugeticon.png</PackageIconUrl>
<PackageProjectUrl>https://github.com/AlanBarber/NLog.Targets.Splunk</PackageProjectUrl>
<PackageLicenseUrl>https://github.com/AlanBarber/NLog.Targets.Splunk/blob/master/LICENSE</PackageLicenseUrl>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>git://github.com/AlanBarber/NLog.Targets.Splunk</RepositoryUrl>
<Version>2.2.1</Version>
<PackageReleaseNotes>Verison 2.2.1
- Introduced MaxConnectionsPerServer property to limit number of connections to splunk server by Rolf Kristensen (https://github.com/snakefoot)
Version 2.2.0
- Updated NLog version from 4.5.6 to 4.5.9
- Added support for Splunk HEC Data channel by David Matz (https://github.com/davidmatz)
Version 2.1.0
- Updated NLog version from 4.5.3 to 4.5.6
- Adding 'IgnoreSslErrors' property to config to allow for using Splunk with self signed certs
- updated to work with NLog's paremeter tooling
- adding abilty to toggle logging of parameters on or off
- several performance updates
- Speical thanks to Rolf Kristensen (https://github.com/snakefoot) for help with this release!
Version 2.0.0
- Updated to support .Net Standard 2.0 and .Net 4.5 w/ NLog 4.5.3
Version 1.0.0
- Code cleanup and performance improvements
Verison 0.0.1
- First publish to NuGet</PackageReleaseNotes>
<Version>3.0.0</Version>
<PackageReleaseNotes>
Version 3.3.0
- Updated NLog version to 4.7.7
- Adding support for .NET Standard 2.1, .NET Core 3.1, and .NET 5.0
- Adding support for custom web proxy configuration by Darek Dan (https://github.com/DarekDan)
- Updating test projects to Net 5.0 by Hangy (https://github.com/hangy)
- Several other minor changes
Verison 2.2.1
- Introduced MaxConnectionsPerServer property to limit number of connections to splunk server by Rolf Kristensen (https://github.com/snakefoot)
Version 2.2.0
- Updated NLog version from 4.5.6 to 4.5.9
- Added support for Splunk HEC Data channel by David Matz (https://github.com/davidmatz)
Version 2.1.0
- Updated NLog version from 4.5.3 to 4.5.6
- Adding 'IgnoreSslErrors' property to config to allow for using Splunk with self signed certs
- updated to work with NLog's paremeter tooling
- adding abilty to toggle logging of parameters on or off
- several performance updates
- Speical thanks to Rolf Kristensen (https://github.com/snakefoot) for help with this release!
Version 2.0.0
- Updated to support .Net Standard 2.0 and .Net 4.5 w/ NLog 4.5.3
Version 1.0.0
- Code cleanup and performance improvements
Verison 0.0.1
- First publish to NuGet
</PackageReleaseNotes>
</PropertyGroup>

<!--common NuGet package refs -->
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="NLog" Version="4.5.11" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="NLog" Version="4.7.7" />
</ItemGroup>

<!-- .NET 5.0 config -->
<PropertyGroup Condition=" '$(TargetFramework)' == 'net5.0' ">
<AssemblyTitle>NLog.Targets.Splunk .NET 5.0</AssemblyTitle>
<DefineConstants>NET50</DefineConstants>
</PropertyGroup>

<!--.NET Core 3.1 config -->
<PropertyGroup Condition=" '$(TargetFramework)' == 'netcoreapp3.1' ">
<AssemblyTitle>NLog.Targets.Splunk .NET Core 3.1</AssemblyTitle>
<DefineConstants>NETCORE;NETSTANDARD</DefineConstants>
</PropertyGroup>

<!--.NET Standard 2.0 config -->
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
<AssemblyTitle>NLog.Targets.Splunk .NET Standard 2.0</AssemblyTitle>
<DefineConstants>NETCORE;NETSTANDARD</DefineConstants>
</PropertyGroup>

<!--.NET Standard 2.1 config -->
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.1' ">
<AssemblyTitle>NLog.Targets.Splunk .NET Standard 2.1</AssemblyTitle>
<DefineConstants>NETCORE;NETSTANDARD</DefineConstants>
</PropertyGroup>

<!-- .NET 4.5 config -->
<PropertyGroup Condition=" '$(TargetFramework)'=='net45' ">
<AssemblyTitle>NLog.Targets.Splunk .NET 4.5</AssemblyTitle>
<DefineConstants>NETFULL</DefineConstants>
</PropertyGroup>

<!-- .NET 4.6.2 config -->
<PropertyGroup Condition=" '$(TargetFramework)'=='net462' ">
<AssemblyTitle>NLog.Targets.Splunk .NET 4.6.2</AssemblyTitle>
<DefineConstants>NETFULL</DefineConstants>
</PropertyGroup>

<!-- .NET 4.7.2 config -->
<PropertyGroup Condition=" '$(TargetFramework)'=='net472' ">
<AssemblyTitle>NLog.Targets.Splunk .NET 4.7.2</AssemblyTitle>
<DefineConstants>NETFULL</DefineConstants>
</PropertyGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net45' or '$(TargetFramework)' == 'net472' ">
<!--.NET 4.8 config -->
<PropertyGroup Condition=" '$(TargetFramework)'=='net48' ">
<AssemblyTitle>NLog.Targets.Splunk .NET 4.8</AssemblyTitle>
<DefineConstants>NETFULL</DefineConstants>
</PropertyGroup>

<ItemGroup Condition=" $(TargetFramework.StartsWith('net4')) ">
<Reference Include="mscorlib" />
<Reference Include="System" />
<Reference Include="System.Core" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
/**
* @copyright
*
* Copyright 2013-2015 Splunk, Inc.
Expand Down Expand Up @@ -26,6 +26,7 @@
using System.Text;
using System.Threading;
using System.Threading.Tasks;

// ReSharper disable CheckNamespace

namespace Splunk.Logging
Expand Down Expand Up @@ -153,10 +154,12 @@ public enum SendMode
/// <param name="batchSizeBytes">Batch max size.</param>
/// <param name="batchSizeCount">Max number of individual events in batch.</param>
/// <param name="ignoreSslErrors">Server validation callback should always return true</param>
/// <param name="useProxy">Default web proxy is used if set to true; otherwise, no proxy is used</param>
/// <param name="proxyConfig">Default web proxy is used if set to true; otherwise, no proxy is used</param>
/// <param name="maxConnectionsPerServer"></param>
/// <param name="middleware">HTTP client middleware. This allows to plug an HttpClient handler that
/// intercepts logging HTTP traffic.</param>
/// <param name="formatter">The formatter.</param>
/// <param name="httpVersion10Hack">Fix for http version 1.0 servers</param>
/// <remarks>
/// Zero values for the batching params mean that batching is off.
/// </remarks>
Expand All @@ -170,7 +173,7 @@ public HttpEventCollectorSender(
int batchSizeBytes,
int batchSizeCount,
bool ignoreSslErrors,
bool useProxy,
ProxyConfiguration proxyConfig,
int maxConnectionsPerServer,
HttpEventCollectorMiddleware middleware,
HttpEventCollectorFormatter formatter = null,
Expand Down Expand Up @@ -221,7 +224,7 @@ public HttpEventCollectorSender(
// setup HTTP client
try
{
var httpMessageHandler = BuildHttpMessageHandler(ignoreSslErrors, useProxy, maxConnectionsPerServer);
var httpMessageHandler = BuildHttpMessageHandler(ignoreSslErrors, maxConnectionsPerServer, proxyConfig);
httpClient = new HttpClient(httpMessageHandler);
}
catch
Expand Down Expand Up @@ -251,32 +254,42 @@ public HttpEventCollectorSender(
/// Builds the HTTP message handler.
/// </summary>
/// <param name="ignoreSslErrors">if set to <c>true</c> [ignore SSL errors].</param>
/// <param name="maxConnectionsPerServer"></param>
/// <param name="proxyConfig"></param>
/// <returns></returns>
private HttpMessageHandler BuildHttpMessageHandler(bool ignoreSslErrors, bool useProxy, int maxConnectionsPerServer)
private HttpMessageHandler BuildHttpMessageHandler(bool ignoreSslErrors, int maxConnectionsPerServer, ProxyConfiguration proxyConfig)
{
#if NET45

#if NET45 || NET462
// Uses the WebRequestHandler for .NET 4.5 - 4.7.0
var httpMessageHandler = new WebRequestHandler();
if (ignoreSslErrors)
{
httpMessageHandler.ServerCertificateValidationCallback = IgnoreServerCertificateCallback;
}

httpMessageHandler.UseProxy = useProxy;
#else
// Uses the new and improved HttpClientHandler() for .NET 4.7.1+ and .NET Standard 2.0+
var httpMessageHandler = new HttpClientHandler();
if (ignoreSslErrors)
{
httpMessageHandler.ServerCertificateCustomValidationCallback = (msg, cert, chain, errors) => IgnoreServerCertificateCallback(msg, cert, chain, errors);
}

httpMessageHandler.UseProxy = useProxy;

if (maxConnectionsPerServer > 0)
{
httpMessageHandler.MaxConnectionsPerServer = maxConnectionsPerServer;
}
#endif
// Setup proxy
httpMessageHandler.UseProxy = proxyConfig.UseProxy;
if (proxyConfig.UseProxy && !string.IsNullOrWhiteSpace(proxyConfig.ProxyUrl))
{
httpMessageHandler.Proxy = new WebProxy(new Uri(proxyConfig.ProxyUrl));
if (!String.IsNullOrWhiteSpace(proxyConfig.ProxyUser) && !String.IsNullOrWhiteSpace(proxyConfig.ProxyPassword))
{
httpMessageHandler.Proxy.Credentials = new NetworkCredential(proxyConfig.ProxyUser, proxyConfig.ProxyPassword);
}
}

return httpMessageHandler;
}

Expand Down Expand Up @@ -493,8 +506,7 @@ private Task<HttpStatusCode> FlushInternalSingleBatch(
/// </summary>
/// <param name="serializedEvents">The serialized events.</param>
/// <returns></returns>
private async Task<HttpStatusCode> PostEvents(
byte[] serializedEvents)
private async Task<HttpStatusCode> PostEvents(byte[] serializedEvents)
{
// encode data
HttpResponseMessage response = null;
Expand Down Expand Up @@ -632,4 +644,4 @@ protected virtual void Dispose(bool disposing)

#endregion
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;

namespace Splunk.Logging
{
public class ProxyConfiguration
{
public bool UseProxy { get; set; } = true;
public string ProxyUrl { get; set; } = String.Empty;
public string ProxyUser { get; set; } = String.Empty;
public string ProxyPassword { get; set; } = String.Empty;
}
}
Loading

0 comments on commit 6597705

Please sign in to comment.