diff --git a/.gitignore b/.gitignore
index fd5204b..94420dc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,8 +4,12 @@
# User-specific files
*.suo
*.user
+*.userosscache
*.sln.docstates
+# User-specific files (MonoDevelop/Xamarin Studio)
+*.userprefs
+
# Build results
[Dd]ebug/
[Dd]ebugPublic/
@@ -13,19 +17,20 @@
[Rr]eleases/
x64/
x86/
-build/
bld/
[Bb]in/
[Oo]bj/
-# Roslyn cache directories
-*.ide/
+# Visual Studio 2015 cache/options directory
+.vs/
+# Uncomment if you have tasks that create the project's static files in wwwroot
+#wwwroot/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
-#NUNIT
+# NUNIT
*.VisualState.xml
TestResult.xml
@@ -34,6 +39,10 @@ TestResult.xml
[Rr]eleasePS/
dlldata.c
+# DNX
+project.lock.json
+artifacts/
+
*_i.c
*_p.c
*_i.h
@@ -66,6 +75,7 @@ _Chutzpah*
ipch/
*.aps
*.ncb
+*.opendb
*.opensdf
*.sdf
*.cachefile
@@ -74,6 +84,7 @@ ipch/
*.psess
*.vsp
*.vspx
+*.sap
# TFS 2012 Local Workspace
$tf/
@@ -86,7 +97,7 @@ _ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
-# JustCode is a .NET coding addin-in
+# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
@@ -98,6 +109,7 @@ _TeamCity*
# NCrunch
_NCrunch_*
.*crunch*.local.xml
+nCrunchTemp_*
# MightyMoose
*.mm.*
@@ -136,21 +148,35 @@ publish/
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
-# If using the old MSBuild-Integrated Package Restore, uncomment this:
+# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
+# NuGet v3's project.json files produces more ignoreable files
+*.nuget.props
+*.nuget.targets
-# Windows Azure Build Output
+# Microsoft Azure Build Output
csx/
*.build.csdef
+# Microsoft Azure Emulator
+ecf/
+rcf/
+
+# Microsoft Azure ApplicationInsights config file
+ApplicationInsights.config
+
# Windows Store app package directory
AppPackages/
+BundleArtifacts/
+
+# Visual Studio cache files
+# files ending in .cache can be ignored
+*.[Cc]ache
+# but keep track of directories ending in .cache
+!*.[Cc]ache/
# Others
-sql/
-*.Cache
ClientBin/
-[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
@@ -158,6 +184,7 @@ ClientBin/
*.pfx
*.publishsettings
node_modules/
+orleans.codegen.cs
# RIA/Silverlight projects
Generated_Code/
@@ -181,3 +208,29 @@ UpgradeLog*.htm
# Microsoft Fakes
FakesAssemblies/
+
+# GhostDoc plugin setting file
+*.GhostDoc.xml
+
+# Node.js Tools for Visual Studio
+.ntvs_analysis.dat
+
+# Visual Studio 6 build log
+*.plg
+
+# Visual Studio 6 workspace options file
+*.opt
+
+# Visual Studio LightSwitch build output
+**/*.HTMLClient/GeneratedArtifacts
+**/*.DesktopClient/GeneratedArtifacts
+**/*.DesktopClient/ModelManifest.xml
+**/*.Server/GeneratedArtifacts
+**/*.Server/ModelManifest.xml
+_Pvt_Extensions
+
+# Paket dependency manager
+.paket/paket.exe
+
+# FAKE - F# Make
+.fake/
diff --git a/.nuget/packages.config b/.nuget/packages.config
deleted file mode 100644
index eab6c5a..0000000
--- a/.nuget/packages.config
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..16ba7d9
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,46 @@
+language: csharp
+
+#dotnet cli require Ubuntu 14.04
+sudo: required
+dist: trusty
+
+#dotnet cli require OSX 10.10
+osx_image: xcode7.1
+
+addons:
+ apt:
+ packages:
+ - gettext
+ - libcurl4-openssl-dev
+ - libicu-dev
+ - libssl-dev
+ - libunwind8
+ - zlib1g
+
+os:
+ - osx
+ - linux
+
+env:
+ matrix:
+ - CLI_VERSION=1.0.0-preview2-003121
+ - CLI_VERSION=Latest
+
+matrix:
+ allow_failures:
+ - env: CLI_VERSION=Latest
+
+before_install:
+ - if test "$TRAVIS_OS_NAME" == "osx"; then brew update; brew install openssl; brew link --force openssl; fi
+ # Download script to install dotnet cli
+ - if test "$CLI_OBTAIN_URL" == ""; then export CLI_OBTAIN_URL="https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0-preview2/scripts/obtain/dotnet-install.sh"; fi
+ - curl -L --create-dirs $CLI_OBTAIN_URL -o ./scripts/obtain/install.sh
+ - find ./scripts -name "*.sh" -exec chmod +x {} \;
+ - export DOTNET_INSTALL_DIR="$PWD/.dotnetcli"
+ # use bash to workaround bug https://github.com/dotnet/cli/issues/1725
+ - sudo bash ./scripts/obtain/install.sh --channel "preview" --version "$CLI_VERSION" --install-dir "$DOTNET_INSTALL_DIR" --no-path
+ # add dotnet to PATH
+ - export PATH="$DOTNET_INSTALL_DIR:$PATH"
+
+script:
+ - ./build.sh
\ No newline at end of file
diff --git a/Build.ps1 b/Build.ps1
index 98d22b6..d28c393 100644
--- a/Build.ps1
+++ b/Build.ps1
@@ -1,73 +1,16 @@
-param(
- [String] $majorMinor = "1.8", # 2.0
- [String] $patch = "0", # $env:APPVEYOR_BUILD_VERSION
- [String] $customLogger = "", # C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll
- [Switch] $notouch
-)
+Push-Location $PSScriptRoot
-function Set-AssemblyVersions($informational, $assembly)
-{
- (Get-Content assets/CommonAssemblyInfo.cs) |
- ForEach-Object { $_ -replace """1.0.0.0""", """$assembly""" } |
- ForEach-Object { $_ -replace """1.0.0""", """$informational""" } |
- ForEach-Object { $_ -replace """1.1.1.1""", """$($informational).0""" } |
- Set-Content assets/CommonAssemblyInfo.cs
-}
+if(Test-Path .\artifacts) { Remove-Item .\artifacts -Force -Recurse }
-function Install-NuGetPackages()
-{
- nuget restore serilog-sinks-splunk.sln
-}
+& dotnet restore
-function Invoke-MSBuild($solution, $customLogger)
-{
- if ($customLogger)
- {
- msbuild "$solution" /verbosity:minimal /p:Configuration=Release /logger:"$customLogger"
- }
- else
- {
- msbuild "$solution" /verbosity:minimal /p:Configuration=Release
- }
-}
+$revision = @{ $true = $env:APPVEYOR_BUILD_NUMBER; $false = 1 }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL];
-function Invoke-NuGetPackProj($csproj)
-{
- nuget pack -Prop Configuration=Release -Symbols $csproj
-}
+Push-Location src/Serilog.Sinks.Splunk
-function Invoke-NuGetPackSpec($nuspec, $version)
-{
- nuget pack $nuspec -Version $version -OutputDirectory ..\..\
-}
+& dotnet pack -c Release -o ..\..\.\artifacts --version-suffix=$revision
+if($LASTEXITCODE -ne 0) { exit 1 }
-function Invoke-NuGetPack($version)
-{
- pushd .\src\Serilog.Sinks.Splunk
- Invoke-NuGetPackSpec "Serilog.Sinks.Splunk.nuspec" $version
- popd
-}
-function Invoke-Build($majorMinor, $patch, $customLogger, $notouch)
-{
- $package="$majorMinor.$patch"
-
- Write-Output "Building Serilog.Sinks.Splunk $package"
-
- if (-not $notouch)
- {
- $assembly = "$majorMinor.0.0"
-
- Write-Output "Assembly version will be set to $assembly"
- Set-AssemblyVersions $package $assembly
- }
-
- Install-NuGetPackages
-
- Invoke-MSBuild "serilog-sinks-splunk.sln" $customLogger
-
- Invoke-NuGetPack $package
-}
-
-$ErrorActionPreference = "Stop"
-Invoke-Build $majorMinor $patch $customLogger $notouch
+Pop-Location
+Pop-Location
diff --git a/CHANGES.md b/CHANGES.md
index 3662a53..b2dd806 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -1,3 +1,11 @@
+##2.0
+ - Support for DotNet Core
+ - Event Collector fluent interface changed to `.WriteTo.EventCollector`
+ - Event Collector Sink targeting core
+ - TCP/UDP Sinks targeting 4.5 *ONLY*
+ - Updated Event Collector HTTP Client to add URI endpoint to host: "services/collector" if not included.
+ - Event Collector changed to use epoch time [#15](https://github.com/serilog/serilog-sinks-splunk/pull/15)
+
##1.8
- Event Collector changed to use epoch time [#15](https://github.com/serilog/serilog-sinks-splunk/pull/15)
diff --git a/README.md b/README.md
index df8c89b..1588fd2 100644
--- a/README.md
+++ b/README.md
@@ -21,23 +21,8 @@ Using the new Event Collector in Splunk 6.3
```csharp
var log = new LoggerConfiguration()
- .WriteTo.SplunkViaEventCollector("https://mysplunk:8088/services/collector", "myeventcollectortoken")
- .CreateLogger();
-```
-
-Set up to log via TCP
-
-```csharp
-var log = new LoggerConfiguration()
- .WriteTo.SplunkViaTcp("127.0.0.1", 10001)
- .CreateLogger();
-```
-
-Or maybe UDP
-
-```csharp
-var log = new LoggerConfiguration()
- .WriteTo.SplunkViaUdp("127.0.0.1", 10000)
+ .WriteTo.EventCollector("https://mysplunk:8088/services/collector", "myeventcollectortoken")
.CreateLogger();
```
+More information is available [here](https://github.com/serilog/serilog-sinks-splunk/wiki).
\ No newline at end of file
diff --git a/appveyor.yml b/appveyor.yml
new file mode 100644
index 0000000..e41635e
--- /dev/null
+++ b/appveyor.yml
@@ -0,0 +1,29 @@
+version: '{build}'
+skip_tags: true
+image: Visual Studio 2015
+configuration: Release
+install:
+ - ps: mkdir -Force ".\build\" | Out-Null
+ - ps: Invoke-WebRequest "https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0-preview2/scripts/obtain/dotnet-install.ps1" -OutFile ".\build\installcli.ps1"
+ - ps: $env:DOTNET_INSTALL_DIR = "$pwd\.dotnetcli"
+ - ps: '& .\build\installcli.ps1 -InstallDir "$env:DOTNET_INSTALL_DIR" -NoPath -Version 1.0.0-preview2-003121'
+ - ps: $env:Path = "$env:DOTNET_INSTALL_DIR;$env:Path"
+build_script:
+- ps: ./Build.ps1
+test: off
+artifacts:
+- path: artifacts/Serilog.*.nupkg
+deploy:
+- provider: NuGet
+ api_key:
+ secure: nvZ/z+pMS91b3kG4DgfES5AcmwwGoBYQxr9kp4XiJHj25SAlgdIxFx++1N0lFH2x
+ skip_symbols: true
+ on:
+ branch: master
+- provider: GitHub
+ auth_token:
+ secure: ggZTqqV1z0xecDoQbeoy3A7xikShCt9FWZIGp95dG9Fo0p5RAT9oGU0ZekHfUIwk
+ artifact: /Serilog.*\.nupkg/
+ tag: v$(appveyor_build_version)
+ on:
+ branch: master
diff --git a/build.sh b/build.sh
new file mode 100755
index 0000000..b874474
--- /dev/null
+++ b/build.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+dotnet restore
+for path in src/*/project.json; do
+ dirname="$(dirname "${path}")"
+ dotnet build ${dirname}
+done
+
+for path in sample/project.json; do
+ dirname="$(dirname "${path}")"
+ dotnet build ${dirname}
+done
\ No newline at end of file
diff --git a/global.json b/global.json
new file mode 100644
index 0000000..b51e28b
--- /dev/null
+++ b/global.json
@@ -0,0 +1,6 @@
+{
+ "projects": [ "src", "test" ],
+ "sdk": {
+ "version": "1.0.0-preview1-002702"
+ }
+}
diff --git a/run_sample.sh b/run_sample.sh
new file mode 100644
index 0000000..07f7797
--- /dev/null
+++ b/run_sample.sh
@@ -0,0 +1,6 @@
+#!/bin/bash
+sh build.sh
+
+cd sample
+dotnet run 15
+cd ..
\ No newline at end of file
diff --git a/sample/Program.cs b/sample/Program.cs
new file mode 100755
index 0000000..8ac2af5
--- /dev/null
+++ b/sample/Program.cs
@@ -0,0 +1,127 @@
+using System.Linq;
+using System.Threading;
+using Serilog;
+using Serilog.Core;
+
+namespace Sample
+{
+ public class Program
+ {
+ public static string EventCollectorToken = "04B42E81-100E-4BED-8AE9-FC5EE4E08602";
+
+ public static void Main(string[] args)
+ {
+ var eventsToCreate = 100;
+
+ if(args.Length > 0)
+ eventsToCreate = int.Parse(args[0]);
+
+ Log.Information("Sample starting up");
+ Serilog.Debugging.SelfLog.Out = System.Console.Out;
+
+ // Vanilla Tests just host
+ Log.Logger = new LoggerConfiguration()
+ .MinimumLevel.Debug()
+ .WriteTo.LiterateConsole()
+ .WriteTo.EventCollector(
+ "http://localhost:8088",
+ Program.EventCollectorToken)
+ .Enrich.WithProperty("Serilog.Sinks.Splunk.Sample", "ViaEventCollector")
+ .Enrich.WithProperty("Serilog.Sinks.Splunk.Sample.TestType", "Vanilla No services/collector")
+ .CreateLogger();
+
+ foreach (var i in Enumerable.Range(0, eventsToCreate))
+ {
+ Log.Information("Running vanilla without extended endpoint loop {Counter}", i);
+ Thread.Sleep(5);
+ }
+
+ // Vanilla Test with full uri specified
+ Log.Logger = new LoggerConfiguration()
+ .MinimumLevel.Debug()
+ .WriteTo.LiterateConsole()
+ .WriteTo.EventCollector(
+ "http://localhost:8088/services/collector",
+ Program.EventCollectorToken)
+ .Enrich.WithProperty("Serilog.Sinks.Splunk.Sample", "ViaEventCollector")
+ .Enrich.WithProperty("Serilog.Sinks.Splunk.Sample.TestType", "Vanilla with full uri specified")
+ .CreateLogger();
+
+ foreach (var i in Enumerable.Range(0, eventsToCreate))
+ {
+ Log.Information("Running vanilla loop {Counter}", i);
+ Thread.Sleep(5);
+ }
+
+ // Override Source
+ Log.Logger = new LoggerConfiguration()
+ .MinimumLevel.Debug()
+ .WriteTo.LiterateConsole()
+ .WriteTo.EventCollector(
+ "http://localhost:8088",
+ Program.EventCollectorToken,
+ source: "Serilog.Sinks.Splunk.Sample")
+ .Enrich.WithProperty("Serilog.Sinks.Splunk.Sample", "ViaEventCollector")
+ .Enrich.WithProperty("Serilog.Sinks.Splunk.Sample.TestType", "Source Override")
+ .CreateLogger();
+
+ foreach (var i in Enumerable.Range(0, eventsToCreate))
+ {
+ Log.Information("Running source override loop {Counter}", i);
+ Thread.Sleep(5);
+ }
+
+ // Override Host
+ Log.Logger = new LoggerConfiguration()
+ .MinimumLevel.Debug()
+ .WriteTo.LiterateConsole()
+ .WriteTo.EventCollector(
+ "http://localhost:8088",
+ Program.EventCollectorToken,
+ host: "myamazingmachine")
+ .Enrich.WithProperty("Serilog.Sinks.Splunk.Sample", "ViaEventCollector")
+ .Enrich.WithProperty("Serilog.Sinks.Splunk.Sample.TestType", "Host Override")
+ .CreateLogger();
+
+ foreach (var i in Enumerable.Range(0, eventsToCreate))
+ {
+ Log.Information("Running host override loop {Counter}", i);
+ Thread.Sleep(5);
+ }
+
+ // No Template
+ Log.Logger = new LoggerConfiguration()
+ .MinimumLevel.Debug()
+ .WriteTo.LiterateConsole()
+ .WriteTo.EventCollector(
+ "http://localhost:8088",
+ Program.EventCollectorToken,
+ renderTemplate: false)
+ .Enrich.WithProperty("Serilog.Sinks.Splunk.Sample", "ViaEventCollector")
+ .Enrich.WithProperty("Serilog.Sinks.Splunk.Sample.TestType", "No Templates")
+ .CreateLogger();
+
+ foreach (var i in Enumerable.Range(0, eventsToCreate))
+ {
+ Log.Information("Running no template loop {Counter}", i);
+ Thread.Sleep(5);
+ }
+
+ // SSL
+ Log.Logger = new LoggerConfiguration()
+ .MinimumLevel.Debug()
+ .WriteTo.LiterateConsole()
+ .WriteTo.EventCollector(
+ "https://localhost:8088",
+ Program.EventCollectorToken)
+ .Enrich.WithProperty("Serilog.Sinks.Splunk.Sample", "ViaEventCollector")
+ .Enrich.WithProperty("Serilog.Sinks.Splunk.Sample.TestType", "HTTPS")
+ .CreateLogger();
+
+ Log.Debug("Waiting for Events to Flush");
+ Thread.Sleep(5000);
+ Log.Debug("Done");
+
+ }
+ }
+}
diff --git a/sample/Serilog.Sinks.Splunk.Sample/App.config b/sample/Serilog.Sinks.Splunk.Sample/App.config
deleted file mode 100644
index 9c05822..0000000
--- a/sample/Serilog.Sinks.Splunk.Sample/App.config
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/sample/Serilog.Sinks.Splunk.Sample/IConfigure.cs b/sample/Serilog.Sinks.Splunk.Sample/IConfigure.cs
deleted file mode 100644
index 66d4f4e..0000000
--- a/sample/Serilog.Sinks.Splunk.Sample/IConfigure.cs
+++ /dev/null
@@ -1,7 +0,0 @@
-namespace Serilog.Sinks.Splunk.Sample
-{
- internal interface IConfigure
- {
- void Configure();
- }
-}
\ No newline at end of file
diff --git a/sample/Serilog.Sinks.Splunk.Sample/Program.cs b/sample/Serilog.Sinks.Splunk.Sample/Program.cs
deleted file mode 100644
index 815f3a6..0000000
--- a/sample/Serilog.Sinks.Splunk.Sample/Program.cs
+++ /dev/null
@@ -1,113 +0,0 @@
-using System;
-using System.Linq;
-using System.Net;
-using Splunk.Client;
-
-
-namespace Serilog.Sinks.Splunk.Sample
-{
- class Program
- {
- public static string EventCollectorToken = "DC279305-1816-44D6-9D7A-6CBB70F0A049";
-
- static void Main(string[] args)
- {
- var stub = new Stub();
-;
- var tcp = new ViaTcp();
- var udp = new ViaUdp();
- var ec = new ViaEventCollector();
- var eco = new ViaEventCollectorWithExtendedOptions();
-
- eco.Configure();
- //ec.Configure();
- //udp.Configure();
- //tcp.Configure();
-
- Log.Information("Simulation running, press any key to exit.");
-
- stub.Run();
-
- var range = Enumerable.Range(0, 100);
-
- foreach (var i in range)
- {
- Log.Information("Say hello to {0}", i);
- }
-
- Console.ReadLine();
- }
- }
-
- class ViaEventCollector : IConfigure
- {
- public void Configure()
- {
- ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true;
-
- Log.Logger = new LoggerConfiguration()
- .WriteTo.LiterateConsole()
- .WriteTo.SplunkViaEventCollector("https://mysplunk:8088/services/collector", Program.EventCollectorToken,
- renderTemplate:false,
- batchSizeLimit:150,
- batchIntervalInSeconds:5)
- .Enrich.WithThreadId()
- .Enrich.WithProperty("Serilog.Sinks.Splunk.Sample", "ViaEventCollector")
- .MinimumLevel.Debug()
- .CreateLogger();
- }
- }
-
- class ViaEventCollectorWithExtendedOptions : IConfigure
- {
- public void Configure()
- {
- ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true;
-
- Log.Logger = new LoggerConfiguration()
- .WriteTo.LiterateConsole()
- .WriteTo.SplunkViaEventCollector("https://mysplunk:8088/services/collector",
- Program.EventCollectorToken,
- "Serilog",
- "",
- Environment.MachineName,
- "" ,
- renderTemplate: false)
- .Enrich.WithThreadId()
- .Enrich.WithProperty("Serilog.Sinks.Splunk.Sample", "ViaEventCollector")
- .MinimumLevel.Debug()
- .CreateLogger();
- }
- }
-
-
- class ViaTcp : IConfigure
- {
- public void Configure()
- {
- Log.Logger = new LoggerConfiguration()
- .WriteTo.LiterateConsole()
- .WriteTo.SplunkViaTcp("127.0.0.1", 10001, renderTemplate: false)
- .Enrich.WithThreadId()
- .Enrich.WithProperty("Serilog.Sinks.Splunk.Sample", "ViaTCP")
- .MinimumLevel.Debug()
- .CreateLogger();
- }
- }
-
- class ViaUdp : IConfigure
- {
- public void Configure()
- {
- Log.Logger = new LoggerConfiguration()
- .WriteTo.LiterateConsole()
- .WriteTo.SplunkViaUdp("127.0.0.1", 10002, renderTemplate: false)
- .Enrich.WithThreadId()
- .Enrich.WithProperty("SplunkSample", "ViaUDP")
- .MinimumLevel.Debug()
- .CreateLogger();
- }
- }
-
-
-}
diff --git a/sample/Serilog.Sinks.Splunk.Sample/Properties/AssemblyInfo.cs b/sample/Serilog.Sinks.Splunk.Sample/Properties/AssemblyInfo.cs
deleted file mode 100644
index 91f33f9..0000000
--- a/sample/Serilog.Sinks.Splunk.Sample/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("Serilog.Sinks.Splunk.Sample")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("Serilog.Sinks.Splunk.Sample")]
-[assembly: AssemblyCopyright("Copyright © 2015")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("eeec2567-cd87-4b00-8749-50b1dd22c975")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/sample/Serilog.Sinks.Splunk.Sample/Serilog.Sinks.Splunk.Sample.csproj b/sample/Serilog.Sinks.Splunk.Sample/Serilog.Sinks.Splunk.Sample.csproj
deleted file mode 100644
index 3eb8323..0000000
--- a/sample/Serilog.Sinks.Splunk.Sample/Serilog.Sinks.Splunk.Sample.csproj
+++ /dev/null
@@ -1,89 +0,0 @@
-
-
-
-
- Debug
- AnyCPU
- {F0B0E4EF-CF01-46FC-A64C-FE3528F14238}
- Exe
- Properties
- Serilog.Sinks.Splunk.Sample
- Serilog.Sinks.Splunk.Sample
- v4.5.1
- 512
- true
-
-
- AnyCPU
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
-
-
- AnyCPU
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
-
-
-
- ..\..\packages\Serilog.1.5.6\lib\net45\Serilog.dll
- True
-
-
- ..\..\packages\serilog-generator.1.0.7\tools\serilog-generator.exe
-
-
- ..\..\packages\Serilog.1.5.6\lib\net45\Serilog.FullNetFx.dll
- True
-
-
- ..\..\packages\Serilog.Sinks.Literate.1.0.6\lib\net45\Serilog.Sinks.Literate.dll
-
-
- ..\..\packages\Splunk.Client.2.1.2\lib\portable-net45+win+wpa81\Splunk.Client.dll
-
-
- ..\..\packages\Splunk.Logging.Common.1.1.0\lib\net45\Splunk.Logging.Common.dll
- True
-
-
- ..\..\packages\Sprache.2.0.0.45\lib\portable-net4+netcore45+win8+wp8+sl5+MonoAndroid1+MonoTouch1\Sprache.dll
- True
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {17deed0f-f9cb-48fb-b4dc-53fb6aee64d7}
- Serilog.Sinks.Splunk.FullNetFx
-
-
-
-
-
\ No newline at end of file
diff --git a/sample/Serilog.Sinks.Splunk.Sample/Stub.cs b/sample/Serilog.Sinks.Splunk.Sample/Stub.cs
deleted file mode 100644
index aadce81..0000000
--- a/sample/Serilog.Sinks.Splunk.Sample/Stub.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-using System.Collections.Concurrent;
-using System.Linq;
-using Serilog.Generator.Actors;
-using Serilog.Generator.Model;
-
-namespace Serilog.Sinks.Splunk.Sample
-{
- internal class Stub
- {
- public void Run()
- {
- const int initialCustomers = 1;
-
- Log.Information("Simulation starting with {InitialCustomers} initial customers...", initialCustomers);
-
- var catalog = new Catalog();
-
- var customers = new ConcurrentBag(Enumerable.Range(0, initialCustomers)
- .Select(_ => new Customer(catalog)));
-
- var traffic = new TrafficReferral(customers, catalog);
- var admin = new Administrator(catalog);
-
- foreach (var c in customers)
- c.Start();
-
- admin.Start();
- traffic.Start();
- }
- }
-}
\ No newline at end of file
diff --git a/sample/Serilog.Sinks.Splunk.Sample/packages.config b/sample/Serilog.Sinks.Splunk.Sample/packages.config
deleted file mode 100644
index f745202..0000000
--- a/sample/Serilog.Sinks.Splunk.Sample/packages.config
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/sample/project.json b/sample/project.json
new file mode 100755
index 0000000..9ebab30
--- /dev/null
+++ b/sample/project.json
@@ -0,0 +1,19 @@
+{
+ "version": "2.0.0",
+ "buildOptions": {
+ "emitEntryPoint": true
+ },
+ "dependencies": {
+ "Microsoft.NETCore.App": {
+ "type": "platform",
+ "version": "1.0.0"
+ },
+ "Serilog.Sinks.Splunk": {"target": "project"},
+ "Serilog.Sinks.Literate": "2.0.0"
+ },
+ "frameworks": {
+ "netcoreapp1.0": {
+ "imports": "dnxcore50"
+ }
+ }
+}
diff --git a/serilog-sinks-splunk.sln b/serilog-sinks-splunk.sln
index 0a457a7..a8948f7 100644
--- a/serilog-sinks-splunk.sln
+++ b/serilog-sinks-splunk.sln
@@ -1,57 +1,50 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
-VisualStudioVersion = 14.0.23107.0
+VisualStudioVersion = 14.0.24720.0
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Serilog.Sinks.Splunk", "src\Serilog.Sinks.Splunk\Serilog.Sinks.Splunk.csproj", "{1493ABC3-811C-46C7-92ED-CEB7567FB588}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Serilog.Sinks.Splunk.FullNetFx", "src\Serilog.Sinks.Splunk.FullNetFx\Serilog.Sinks.Splunk.FullNetFx.csproj", "{17DEED0F-F9CB-48FB-B4DC-53FB6AEE64D7}"
-EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{7A774CBB-A6E9-4854-B4DB-4CF860B0C1C5}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "assets", "assets", "{B9B13339-749C-4098-8845-780ED4FA488A}"
ProjectSection(SolutionItems) = preProject
Build.ps1 = Build.ps1
CHANGES.md = CHANGES.md
- assets\CommonAssemblyInfo.cs = assets\CommonAssemblyInfo.cs
+ global.json = global.json
README.md = README.md
assets\Serilog.snk = assets\Serilog.snk
EndProjectSection
EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Sample", "Sample", "{EBB6CE48-09B0-4789-9627-45A1D4D377F7}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Serilog.Sinks.Splunk.Sample", "sample\Serilog.Sinks.Splunk.Sample\Serilog.Sinks.Splunk.Sample.csproj", "{F0B0E4EF-CF01-46FC-A64C-FE3528F14238}"
-EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{B16AD407-36C8-4286-A3E9-CACEBF359731}"
ProjectSection(SolutionItems) = preProject
.nuget\packages.config = .nuget\packages.config
EndProjectSection
EndProject
+Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Serilog.Sinks.Splunk", "src\Serilog.Sinks.Splunk\Serilog.Sinks.Splunk.xproj", "{32CF915C-3ECD-496C-8FDB-1214581274A6}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sample", "sample", "{1C75E4A9-4CB1-497C-AD17-B438882051A1}"
+EndProject
+Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Sample", "src\sample\Sample.xproj", "{17497155-5D94-45DF-81D9-BD960E8CF217}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {1493ABC3-811C-46C7-92ED-CEB7567FB588}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {1493ABC3-811C-46C7-92ED-CEB7567FB588}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {1493ABC3-811C-46C7-92ED-CEB7567FB588}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {1493ABC3-811C-46C7-92ED-CEB7567FB588}.Release|Any CPU.Build.0 = Release|Any CPU
- {17DEED0F-F9CB-48FB-B4DC-53FB6AEE64D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {17DEED0F-F9CB-48FB-B4DC-53FB6AEE64D7}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {17DEED0F-F9CB-48FB-B4DC-53FB6AEE64D7}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {17DEED0F-F9CB-48FB-B4DC-53FB6AEE64D7}.Release|Any CPU.Build.0 = Release|Any CPU
- {F0B0E4EF-CF01-46FC-A64C-FE3528F14238}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {F0B0E4EF-CF01-46FC-A64C-FE3528F14238}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {F0B0E4EF-CF01-46FC-A64C-FE3528F14238}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {F0B0E4EF-CF01-46FC-A64C-FE3528F14238}.Release|Any CPU.Build.0 = Release|Any CPU
+ {32CF915C-3ECD-496C-8FDB-1214581274A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {32CF915C-3ECD-496C-8FDB-1214581274A6}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {32CF915C-3ECD-496C-8FDB-1214581274A6}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {32CF915C-3ECD-496C-8FDB-1214581274A6}.Release|Any CPU.Build.0 = Release|Any CPU
+ {17497155-5D94-45DF-81D9-BD960E8CF217}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {17497155-5D94-45DF-81D9-BD960E8CF217}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {17497155-5D94-45DF-81D9-BD960E8CF217}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {17497155-5D94-45DF-81D9-BD960E8CF217}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
- {1493ABC3-811C-46C7-92ED-CEB7567FB588} = {7A774CBB-A6E9-4854-B4DB-4CF860B0C1C5}
- {17DEED0F-F9CB-48FB-B4DC-53FB6AEE64D7} = {7A774CBB-A6E9-4854-B4DB-4CF860B0C1C5}
- {F0B0E4EF-CF01-46FC-A64C-FE3528F14238} = {EBB6CE48-09B0-4789-9627-45A1D4D377F7}
+ {32CF915C-3ECD-496C-8FDB-1214581274A6} = {7A774CBB-A6E9-4854-B4DB-4CF860B0C1C5}
+ {17497155-5D94-45DF-81D9-BD960E8CF217} = {1C75E4A9-4CB1-497C-AD17-B438882051A1}
EndGlobalSection
EndGlobal
diff --git a/src/Serilog.Sinks.Splunk.FullNetFx/Properties/AssemblyInfo.cs b/src/Serilog.Sinks.Splunk.FullNetFx/Properties/AssemblyInfo.cs
deleted file mode 100644
index 7e13209..0000000
--- a/src/Serilog.Sinks.Splunk.FullNetFx/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-[assembly: AssemblyTitle("Serilog.Sinks.Splunk.FullNetFx")]
-[assembly: AssemblyDescription("Serilog sink for Splunk using .Net 4.5")]
-[assembly: AssemblyCopyright("Copyright © Serilog Contributors 2014")]
-
-[assembly: InternalsVisibleTo("Serilog.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100fb8d13fd344a1c" +
- "6fe0fe83ef33c1080bf30690765bc6eb0df26ebfdf8f21670c64265b30db09f73a0dea5b3db4c9" +
- "d18dbf6d5a25af5ce9016f281014d79dc3b4201ac646c451830fc7e61a2dfd633d34c39f87b818" +
- "94191652df5ac63cc40c77f3542f702bda692e6e8a9158353df189007a49da0f3cfd55eb250066" +
- "b19485ec")]
\ No newline at end of file
diff --git a/src/Serilog.Sinks.Splunk.FullNetFx/Serilog.Sinks.Splunk.FullNetFx.csproj b/src/Serilog.Sinks.Splunk.FullNetFx/Serilog.Sinks.Splunk.FullNetFx.csproj
deleted file mode 100644
index d8fae9a..0000000
--- a/src/Serilog.Sinks.Splunk.FullNetFx/Serilog.Sinks.Splunk.FullNetFx.csproj
+++ /dev/null
@@ -1,107 +0,0 @@
-
-
-
-
- Debug
- AnyCPU
- {17DEED0F-F9CB-48FB-B4DC-53FB6AEE64D7}
- Library
- Properties
- Serilog
- Serilog.Sinks.Splunk.FullNetFx
- v4.5
- 512
-
-
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
- bin\Debug\Serilog.Sinks.Splunk.FullNetFx.XML
- true
-
-
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
- bin\Release\Serilog.Sinks.Splunk.FullNetFx.XML
- true
-
-
- false
-
-
- ..\..\assets\Serilog.snk
-
-
-
- ..\..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll
- True
-
-
- ..\..\packages\Serilog.1.5.11\lib\net45\Serilog.dll
- True
-
-
- ..\..\packages\Serilog.1.5.11\lib\net45\Serilog.FullNetFx.dll
- True
-
-
- ..\..\packages\Splunk.Logging.Common.1.5.0\lib\net45\Splunk.Logging.Common.dll
- True
-
-
-
-
-
-
-
-
- LoggerConfigurationSplunkPCLExtensions.cs
-
-
- Sinks\Splunk\Epoch.cs
-
-
- Sinks\Splunk\EventCollectorClient.cs
-
-
- Sinks\Splunk\EventCollectorRequest.cs
-
-
- Sinks\Splunk\EventCollectorSink.cs
-
-
- Sinks\Splunk\RepeatAction.cs
-
-
- Sinks\Splunk\SplunkJsonFormatter.cs
-
-
-
- Properties\CommonAssemblyInfo.cs
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/Serilog.Sinks.Splunk.FullNetFx/Sinks/Splunk/SplunkTcpSinkConnectionInfo.cs b/src/Serilog.Sinks.Splunk.FullNetFx/Sinks/Splunk/SplunkTcpSinkConnectionInfo.cs
deleted file mode 100644
index b6b3eaf..0000000
--- a/src/Serilog.Sinks.Splunk.FullNetFx/Sinks/Splunk/SplunkTcpSinkConnectionInfo.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-using System.Net;
-
-namespace Serilog.Sinks.Splunk
-{
- ///
- /// Defines connection info used to connect against Splunk
- /// using TCP.
- ///
- public class SplunkTcpSinkConnectionInfo
- {
- ///
- /// Default size of the socket writer queue.
- ///
- public const int DefaultMaxQueueSize = 10000;
-
- ///
- /// Splunk host.
- ///
- public IPAddress Host { get; }
-
- ///
- /// Splunk port.
- ///
- public int Port { get; }
-
- ///
- /// Max Queue size for the TCP socket writer.
- /// See for default value (10000).
- ///
- public int MaxQueueSize { get; set; } = DefaultMaxQueueSize;
-
- ///
- /// Creates an instance of used
- /// for defining connection info for connecting using TCP against Splunk.
- ///
- /// Splunk host.
- /// Splunk TCP port.
- public SplunkTcpSinkConnectionInfo(string host, int port) : this(IPAddress.Parse(host), port){ }
-
- ///
- /// Creates an instance of used
- /// for defining connection info for connecting using TCP against Splunk.
- ///
- /// Splunk host.
- /// Splunk TCP port.
- public SplunkTcpSinkConnectionInfo(IPAddress host, int port)
- {
- Host = host;
- Port = port;
- }
- }
-}
\ No newline at end of file
diff --git a/src/Serilog.Sinks.Splunk.FullNetFx/Sinks/Splunk/SplunkUdpSinkConnectionInfo.cs b/src/Serilog.Sinks.Splunk.FullNetFx/Sinks/Splunk/SplunkUdpSinkConnectionInfo.cs
deleted file mode 100644
index b1f2bbd..0000000
--- a/src/Serilog.Sinks.Splunk.FullNetFx/Sinks/Splunk/SplunkUdpSinkConnectionInfo.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-using System.Net;
-
-namespace Serilog.Sinks.Splunk
-{
- ///
- /// Defines connection info used to connect against Splunk
- /// using UDP.
- ///
- public class SplunkUdpSinkConnectionInfo
- {
- ///
- /// Splunk host.
- ///
- public IPAddress Host { get; }
-
- ///
- /// Splunk port.
- ///
- public int Port { get; }
-
- ///
- /// Creates an instance of used
- /// for defining connection info for connecting using UDP against Splunk.
- ///
- /// Splunk host.
- /// Splunk UDP port.
- public SplunkUdpSinkConnectionInfo(string host, int port) : this(IPAddress.Parse(host), port){ }
-
- ///
- /// Creates an instance of used
- /// for defining connection info for connecting using UDP against Splunk.
- ///
- /// Splunk host.
- /// Splunk UDP port.
- public SplunkUdpSinkConnectionInfo(IPAddress host, int port)
- {
- Host = host;
- Port = port;
- }
- }
-}
\ No newline at end of file
diff --git a/src/Serilog.Sinks.Splunk.FullNetFx/packages.config b/src/Serilog.Sinks.Splunk.FullNetFx/packages.config
deleted file mode 100644
index 8b7ee2f..0000000
--- a/src/Serilog.Sinks.Splunk.FullNetFx/packages.config
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/Serilog.Sinks.Splunk/Properties/AssemblyInfo.cs b/src/Serilog.Sinks.Splunk/Properties/AssemblyInfo.cs
index d344184..f7d5b25 100644
--- a/src/Serilog.Sinks.Splunk/Properties/AssemblyInfo.cs
+++ b/src/Serilog.Sinks.Splunk/Properties/AssemblyInfo.cs
@@ -1,12 +1,4 @@
using System.Reflection;
using System.Runtime.CompilerServices;
-[assembly: AssemblyTitle("Serilog.Sinks.Splunk")]
-[assembly: AssemblyDescription("Serilog sink for Splunk")]
-[assembly: AssemblyCopyright("Copyright © Serilog Contributors 2014")]
-
-[assembly: InternalsVisibleTo("Serilog.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100fb8d13fd344a1c" +
- "6fe0fe83ef33c1080bf30690765bc6eb0df26ebfdf8f21670c64265b30db09f73a0dea5b3db4c9" +
- "d18dbf6d5a25af5ce9016f281014d79dc3b4201ac646c451830fc7e61a2dfd633d34c39f87b818" +
- "94191652df5ac63cc40c77f3542f702bda692e6e8a9158353df189007a49da0f3cfd55eb250066" +
- "b19485ec")]
\ No newline at end of file
+[assembly: AssemblyVersion("2.0.0.0")]
diff --git a/src/Serilog.Sinks.Splunk/Serilog.Sinks.Splunk.csproj b/src/Serilog.Sinks.Splunk/Serilog.Sinks.Splunk.csproj
deleted file mode 100644
index 38d5b6d..0000000
--- a/src/Serilog.Sinks.Splunk/Serilog.Sinks.Splunk.csproj
+++ /dev/null
@@ -1,78 +0,0 @@
-
-
-
-
- 11.0
- Debug
- AnyCPU
- {1493ABC3-811C-46C7-92ED-CEB7567FB588}
- Library
- Properties
- Serilog
- Serilog.Sinks.Splunk
- en-US
- 512
- {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- Profile7
- v4.5
-
-
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
- bin\Debug\Serilog.Sinks.Splunk.XML
- true
-
-
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
- bin\Release\Serilog.Sinks.Splunk.XML
- true
-
-
- false
-
-
- ..\..\assets\Serilog.snk
-
-
-
-
-
-
-
-
-
-
- Properties\CommonAssemblyInfo.cs
-
-
-
-
-
-
-
-
-
-
- ..\..\packages\Serilog.1.5.11\lib\portable-net45+win+wpa81+wp80+MonoAndroid10+MonoTouch10\Serilog.dll
- True
-
-
-
-
-
\ No newline at end of file
diff --git a/src/Serilog.Sinks.Splunk/Serilog.Sinks.Splunk.nuspec b/src/Serilog.Sinks.Splunk/Serilog.Sinks.Splunk.nuspec
deleted file mode 100644
index 24394f6..0000000
--- a/src/Serilog.Sinks.Splunk/Serilog.Sinks.Splunk.nuspec
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-
- Serilog.Sinks.Splunk
- $version$
- Matthew Erbs, Serilog Contributors
- Serilog event sink that writes to Splunk.
- en-US
- http://serilog.net
- http://www.apache.org/licenses/LICENSE-2.0
- http://serilog.net/images/serilog-sink-nuget.png
- serilog logging splunk
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/Serilog.Sinks.Splunk/Serilog.Sinks.Splunk.xproj b/src/Serilog.Sinks.Splunk/Serilog.Sinks.Splunk.xproj
new file mode 100644
index 0000000..5ebac95
--- /dev/null
+++ b/src/Serilog.Sinks.Splunk/Serilog.Sinks.Splunk.xproj
@@ -0,0 +1,18 @@
+
+
+
+ 14.0
+ $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
+
+
+
+ 32cf915c-3ecd-496c-8fdb-1214581274a6
+ Serilog
+ .\obj
+ .\bin\
+
+
+ 2.0
+
+
+
\ No newline at end of file
diff --git a/src/Serilog.Sinks.Splunk/Sinks/Splunk/Epoch.cs b/src/Serilog.Sinks.Splunk/Sinks/Splunk/Epoch.cs
index 8be376e..0f4c39b 100644
--- a/src/Serilog.Sinks.Splunk/Sinks/Splunk/Epoch.cs
+++ b/src/Serilog.Sinks.Splunk/Sinks/Splunk/Epoch.cs
@@ -1,4 +1,18 @@
-namespace Serilog.Sinks.Splunk
+// Copyright 2016 Serilog Contributors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+namespace Serilog.Sinks.Splunk
{
using System;
@@ -17,4 +31,4 @@ public static double ToEpoch(this DateTimeOffset value)
return Math.Round((value - Epoch).TotalSeconds, 3, MidpointRounding.AwayFromZero);
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Serilog.Sinks.Splunk/Sinks/Splunk/EventCollectorClient.cs b/src/Serilog.Sinks.Splunk/Sinks/Splunk/EventCollectorClient.cs
index 5909dc7..c66797b 100644
--- a/src/Serilog.Sinks.Splunk/Sinks/Splunk/EventCollectorClient.cs
+++ b/src/Serilog.Sinks.Splunk/Sinks/Splunk/EventCollectorClient.cs
@@ -1,3 +1,18 @@
+// Copyright 2016 Serilog Contributors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+
using System;
using System.Net.Http;
using System.Net.Http.Headers;
@@ -10,5 +25,10 @@ public EventCollectorClient(string eventCollectorToken) : base()
{
DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Splunk", eventCollectorToken);
}
+
+ public EventCollectorClient(string eventCollectorToken, HttpMessageHandler messageHandler) : base(messageHandler)
+ {
+ DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Splunk", eventCollectorToken);
+ }
}
}
\ No newline at end of file
diff --git a/src/Serilog.Sinks.Splunk/Sinks/Splunk/EventCollectorRequest.cs b/src/Serilog.Sinks.Splunk/Sinks/Splunk/EventCollectorRequest.cs
index 3024091..e4667e1 100644
--- a/src/Serilog.Sinks.Splunk/Sinks/Splunk/EventCollectorRequest.cs
+++ b/src/Serilog.Sinks.Splunk/Sinks/Splunk/EventCollectorRequest.cs
@@ -1,4 +1,20 @@
+// Copyright 2016 Serilog Contributors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+
using System;
+using System.Globalization;
using System.Net.Http;
using System.Text;
@@ -34,7 +50,7 @@ internal SplunkEvent(string logEvent, string source, string sourceType, string h
if (time > 0)
{
- jsonPayLoad = jsonPayLoad + @",""time"":" + time;
+ jsonPayLoad = jsonPayLoad + @",""time"":" + time.ToString(CultureInfo.InvariantCulture);
}
jsonPayLoad = jsonPayLoad + "}";
@@ -49,11 +65,17 @@ public string Payload
internal class EventCollectorRequest : HttpRequestMessage
{
- internal EventCollectorRequest(string splunkHost, string jsonPayLoad)
+ internal EventCollectorRequest(string splunkHost, string jsonPayLoad, string uri ="services/collector")
{
+ var hostUrl = $@"{splunkHost}/{uri}";
+ if(splunkHost.Contains("services/collector"))
+ {
+ hostUrl = $@"{splunkHost}";
+ }
+
var stringContent = new StringContent(jsonPayLoad, Encoding.UTF8, "application/json");
- RequestUri = new Uri(splunkHost);
+ RequestUri = new Uri(hostUrl);
Content = stringContent;
Method = HttpMethod.Post;
}
diff --git a/src/Serilog.Sinks.Splunk/Sinks/Splunk/EventCollectorSink.cs b/src/Serilog.Sinks.Splunk/Sinks/Splunk/EventCollectorSink.cs
index b217f7d..ee9f10d 100644
--- a/src/Serilog.Sinks.Splunk/Sinks/Splunk/EventCollectorSink.cs
+++ b/src/Serilog.Sinks.Splunk/Sinks/Splunk/EventCollectorSink.cs
@@ -1,5 +1,4 @@
-
-// Copyright 2014 Serilog Contributors
+// Copyright 2016 Serilog Contributors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -19,6 +18,7 @@
using System.IO;
using System.Linq;
using System.Net;
+using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using Serilog.Core;
@@ -38,10 +38,15 @@ public class EventCollectorSink : ILogEventSink, IDisposable
private readonly string _sourceType;
private readonly string _host;
private readonly string _index;
+ private readonly string _uriPath;
private readonly int _batchSizeLimitLimit;
private readonly SplunkJsonFormatter _jsonFormatter;
private readonly ConcurrentQueue _queue;
private readonly EventCollectorClient _httpClient;
+ private const string DefaultSource = "";
+ private const string DefaultSourceType = "";
+ private const string DefaultHost = "";
+ private const string DefaultIndex = "";
///
/// Taken from Splunk.Logging.Common
@@ -51,7 +56,7 @@ public class EventCollectorSink : ILogEventSink, IDisposable
HttpStatusCode.Forbidden,
HttpStatusCode.MethodNotAllowed,
HttpStatusCode.BadRequest
- };
+ };
///
/// Creates a new instance of the sink
@@ -78,22 +83,22 @@ public EventCollectorSink(
_batchSizeLimitLimit = batchSizeLimit;
var batchInterval = TimeSpan.FromSeconds(batchIntervalInSeconds);
-
_httpClient = new EventCollectorClient(_eventCollectorToken);
-
+
var cancellationToken = new CancellationToken();
-
+
RepeatAction.OnInterval(
batchInterval,
async () => await ProcessQueue(),
cancellationToken);
- }
+ }
///
/// Creates a new instance of the sink
///
/// The host of the Splunk instance with the Event collector configured
/// The token to use when authenticating with the event collector
+ /// Change the default endpoint of the Event Collector e.g. services/collector/event
/// The size of the batch when sending to the event collector
/// The format provider used when rendering the message
/// Whether to render the message template
@@ -105,12 +110,13 @@ public EventCollectorSink(
public EventCollectorSink(
string splunkHost,
string eventCollectorToken,
+ string uriPath,
string source,
string sourceType,
string host,
string index,
- int batchIntervalInSeconds = 5,
- int batchSizeLimit = 100,
+ int batchIntervalInSeconds,
+ int batchSizeLimit,
IFormatProvider formatProvider = null,
bool renderTemplate = true
) : this(splunkHost,
@@ -124,6 +130,7 @@ public EventCollectorSink(
_sourceType = sourceType;
_host = host;
_index = index;
+ _uriPath = uriPath;
}
///
@@ -176,13 +183,13 @@ private async Task Send(IEnumerable events)
_jsonFormatter.Format(logEvent, sw);
var serialisedEvent = sw.ToString();
-
+
var splunkEvent = new SplunkEvent(serialisedEvent, _source, _sourceType, _host, _index, logEvent.Timestamp.ToEpoch());
allEvents = $"{allEvents}{splunkEvent.Payload}";
}
- var request = new EventCollectorRequest(_splunkHost, allEvents);
+ var request = new EventCollectorRequest(_splunkHost, allEvents, _uriPath);
var response = await _httpClient.SendAsync(request);
if (response.IsSuccessStatusCode)
@@ -237,4 +244,4 @@ protected virtual void Dispose(bool disposing)
_httpClient.Dispose();
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Serilog.Sinks.Splunk/Sinks/Splunk/RepeatAction.cs b/src/Serilog.Sinks.Splunk/Sinks/Splunk/RepeatAction.cs
index 4a3f134..ee39d6f 100644
--- a/src/Serilog.Sinks.Splunk/Sinks/Splunk/RepeatAction.cs
+++ b/src/Serilog.Sinks.Splunk/Sinks/Splunk/RepeatAction.cs
@@ -1,4 +1,4 @@
-// Copyright 2014 Serilog Contributors
+// Copyright 2016 Serilog Contributors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
diff --git a/src/Serilog.Sinks.Splunk.FullNetFx/Sinks/Splunk/TcpSink.cs b/src/Serilog.Sinks.Splunk/Sinks/Splunk/TcpSink.cs
similarity index 73%
rename from src/Serilog.Sinks.Splunk.FullNetFx/Sinks/Splunk/TcpSink.cs
rename to src/Serilog.Sinks.Splunk/Sinks/Splunk/TcpSink.cs
index 34c3903..5583ab4 100644
--- a/src/Serilog.Sinks.Splunk.FullNetFx/Sinks/Splunk/TcpSink.cs
+++ b/src/Serilog.Sinks.Splunk/Sinks/Splunk/TcpSink.cs
@@ -1,4 +1,6 @@
-// Copyright 2014 Serilog Contributors
+#if TCP
+
+// Copyright 2016 Serilog Contributors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -121,4 +123,55 @@ public void Dispose()
_writer = null;
}
}
-}
\ No newline at end of file
+
+
+ ///
+ /// Defines connection info used to connect against Splunk
+ /// using TCP.
+ ///
+ public class SplunkTcpSinkConnectionInfo
+ {
+ ///
+ /// Default size of the socket writer queue.
+ ///
+ public const int DefaultMaxQueueSize = 10000;
+
+ ///
+ /// Splunk host.
+ ///
+ public IPAddress Host { get; }
+
+ ///
+ /// Splunk port.
+ ///
+ public int Port { get; }
+
+ ///
+ /// Max Queue size for the TCP socket writer.
+ /// See for default value (10000).
+ ///
+ public int MaxQueueSize { get; set; } = DefaultMaxQueueSize;
+
+ ///
+ /// Creates an instance of used
+ /// for defining connection info for connecting using TCP against Splunk.
+ ///
+ /// Splunk host.
+ /// Splunk TCP port.
+ public SplunkTcpSinkConnectionInfo(string host, int port) : this(IPAddress.Parse(host), port) { }
+
+ ///
+ /// Creates an instance of used
+ /// for defining connection info for connecting using TCP against Splunk.
+ ///
+ /// Splunk host.
+ /// Splunk TCP port.
+ public SplunkTcpSinkConnectionInfo(IPAddress host, int port)
+ {
+ Host = host;
+ Port = port;
+ }
+ }
+}
+
+#endif
\ No newline at end of file
diff --git a/src/Serilog.Sinks.Splunk.FullNetFx/Sinks/Splunk/UdpSink.cs b/src/Serilog.Sinks.Splunk/Sinks/Splunk/UdpSink.cs
similarity index 77%
rename from src/Serilog.Sinks.Splunk.FullNetFx/Sinks/Splunk/UdpSink.cs
rename to src/Serilog.Sinks.Splunk/Sinks/Splunk/UdpSink.cs
index f895bbe..e8a64f0 100644
--- a/src/Serilog.Sinks.Splunk.FullNetFx/Sinks/Splunk/UdpSink.cs
+++ b/src/Serilog.Sinks.Splunk/Sinks/Splunk/UdpSink.cs
@@ -1,4 +1,7 @@
-// Copyright 2014 Serilog Contributors
+#if UDP
+
+
+// Copyright 2016 Serilog Contributors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -87,7 +90,7 @@ public UdpSink(string host, int port, IFormatProvider formatProvider = null, boo
/// If true, the message template will be rendered
[Obsolete("Use the overload accepting a connection info object instead. This overload will be removed.", false)]
public UdpSink(IPAddress hostAddress, int port, IFormatProvider formatProvider = null, bool renderTemplate = true)
- : this(new SplunkUdpSinkConnectionInfo(hostAddress, port),formatProvider, renderTemplate)
+ : this(new SplunkUdpSinkConnectionInfo(hostAddress, port), formatProvider, renderTemplate)
{
}
@@ -115,4 +118,43 @@ public void Dispose()
_socket = null;
}
}
+
+ ///
+ /// Defines connection info used to connect against Splunk
+ /// using UDP.
+ ///
+ public class SplunkUdpSinkConnectionInfo
+ {
+ ///
+ /// Splunk host.
+ ///
+ public IPAddress Host { get; }
+
+ ///
+ /// Splunk port.
+ ///
+ public int Port { get; }
+
+ ///
+ /// Creates an instance of used
+ /// for defining connection info for connecting using UDP against Splunk.
+ ///
+ /// Splunk host.
+ /// Splunk UDP port.
+ public SplunkUdpSinkConnectionInfo(string host, int port) : this(IPAddress.Parse(host), port) { }
+
+ ///
+ /// Creates an instance of used
+ /// for defining connection info for connecting using UDP against Splunk.
+ ///
+ /// Splunk host.
+ /// Splunk UDP port.
+ public SplunkUdpSinkConnectionInfo(IPAddress host, int port)
+ {
+ Host = host;
+ Port = port;
+ }
+ }
}
+
+#endif
\ No newline at end of file
diff --git a/src/Serilog.Sinks.Splunk.FullNetFx/LoggerConfigurationSplunkExtensions.cs b/src/Serilog.Sinks.Splunk/SplunkLoggingConfigurationClassicExtensions.cs
similarity index 99%
rename from src/Serilog.Sinks.Splunk.FullNetFx/LoggerConfigurationSplunkExtensions.cs
rename to src/Serilog.Sinks.Splunk/SplunkLoggingConfigurationClassicExtensions.cs
index 273c9a6..8c7f708 100644
--- a/src/Serilog.Sinks.Splunk.FullNetFx/LoggerConfigurationSplunkExtensions.cs
+++ b/src/Serilog.Sinks.Splunk/SplunkLoggingConfigurationClassicExtensions.cs
@@ -1,4 +1,6 @@
-// Copyright 2014 Serilog Contributors
+#if TCP
+
+// Copyright 2016 Serilog Contributors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -18,7 +20,7 @@
using Serilog.Events;
using Serilog.Formatting;
using Serilog.Formatting.Display;
-using Serilog.Sinks.Splunk;
+using Serilog.Sinks.Splunk;
namespace Serilog
{
@@ -208,4 +210,6 @@ public static LoggerConfiguration SplunkViaTcp(
return loggerConfiguration.Sink(sink, restrictedToMinimumLevel);
}
}
-}
\ No newline at end of file
+}
+
+#endif
\ No newline at end of file
diff --git a/src/Serilog.Sinks.Splunk/LoggerConfigurationSplunkPCLExtensions.cs b/src/Serilog.Sinks.Splunk/SplunkLoggingConfigurationExtensions.cs
similarity index 53%
rename from src/Serilog.Sinks.Splunk/LoggerConfigurationSplunkPCLExtensions.cs
rename to src/Serilog.Sinks.Splunk/SplunkLoggingConfigurationExtensions.cs
index 4de88de..3db143b 100644
--- a/src/Serilog.Sinks.Splunk/LoggerConfigurationSplunkPCLExtensions.cs
+++ b/src/Serilog.Sinks.Splunk/SplunkLoggingConfigurationExtensions.cs
@@ -1,4 +1,4 @@
-// Copyright 2014 Serilog Contributors
+// Copyright 2016 Serilog Contributors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -12,102 +12,72 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+
using System;
+using System.Net.Http;
using Serilog.Configuration;
using Serilog.Events;
-using Serilog.Formatting.Display;
using Serilog.Sinks.Splunk;
namespace Serilog
{
///
- /// Fluent extenstions for the Serilog configuration
+ /// Fluent configuration methods for Logger configuration
///
- public static class LoggerConfigurationSplunkPCLExtensions
+ public static class SplunkLoggingConfigurationExtensions
{
-
internal const string DefaultOutputTemplate =
"{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level}] {Message}{NewLine}{Exception}";
-
- ///
- /// Adds a sink that writes log events as to a Splunk instance via UDP.
- ///
- /// The logger config
- /// The Splunk host that is configured with an Event Collector
- /// The token provided to authenticate to the Splunk Event Collector
- /// The minimum log event level required in order to write an event to the sink.
- /// The output template to be used when logging
- /// Supplies culture-specific formatting information, or null.
- /// If ture, the message template will be rendered
- /// The interval in seconds that the queue should be instpected for batching
- /// The size of the batch
- ///
- public static LoggerConfiguration SplunkViaEventCollector(
- this LoggerSinkConfiguration configuration,
- string splunkHost,
- string eventCollectorToken,
- LogEventLevel restrictedToMinimumLevel = LevelAlias.Minimum,
- string outputTemplate = DefaultOutputTemplate,
- IFormatProvider formatProvider = null,
- bool renderTemplate = true,
- int batchIntervalInSeconds = 2,
- int batchSizeLimit = 100)
- {
- if (configuration == null) throw new ArgumentNullException(nameof(configuration));
- if (outputTemplate == null) throw new ArgumentNullException(nameof(outputTemplate));
- var eventCollectorSink = new EventCollectorSink(
- splunkHost,
- eventCollectorToken,
- batchIntervalInSeconds,
- batchSizeLimit,
- formatProvider,
- renderTemplate);
-
- return configuration.Sink(eventCollectorSink, restrictedToMinimumLevel);
- }
+ internal const string DefaultSource = "";
+ internal const string DefaultSourceType = "";
+ internal const string DefaultHost = "";
+ internal const string DefaultIndex = "";
///
- /// Adds a sink that writes log events as to a Splunk instance via UDP.
+ /// Adds a sink that writes log events as to a Splunk instance via the HTTP Event Collector.
///
/// The logger config
/// The Splunk host that is configured with an Event Collector
/// The token provided to authenticate to the Splunk Event Collector
+ /// Change the default endpoint of the Event Collector e.g. services/collector/event
+ /// The Splunk index to log to
+ /// The source of the event
+ /// The source type of the event
+ /// The host of the event
/// The minimum log event level required in order to write an event to the sink.
/// The output template to be used when logging
/// Supplies culture-specific formatting information, or null.
/// If ture, the message template will be rendered
/// The interval in seconds that the queue should be instpected for batching
/// The size of the batch
- /// The Splunk index to log to
- /// The source of the event
- /// The source type of the event
- /// The host of the event
///
- public static LoggerConfiguration SplunkViaEventCollector(
+ public static LoggerConfiguration EventCollector(
this LoggerSinkConfiguration configuration,
string splunkHost,
string eventCollectorToken,
- string source,
- string sourceType,
- string host,
- string index,
+ string uriPath = "services/collector",
+ string source = DefaultSource,
+ string sourceType = DefaultSourceType,
+ string host = DefaultHost,
+ string index = DefaultIndex,
LogEventLevel restrictedToMinimumLevel = LevelAlias.Minimum,
string outputTemplate = DefaultOutputTemplate,
IFormatProvider formatProvider = null,
bool renderTemplate = true,
int batchIntervalInSeconds = 2,
- int batchSizeLimit = 10)
+ int batchSizeLimit = 100)
{
if (configuration == null) throw new ArgumentNullException(nameof(configuration));
if (outputTemplate == null) throw new ArgumentNullException(nameof(outputTemplate));
var eventCollectorSink = new EventCollectorSink(
splunkHost,
- eventCollectorToken,
- source,
- sourceType,
- host,
+ eventCollectorToken,
+ uriPath,
+ source,
+ sourceType,
+ host,
index,
batchIntervalInSeconds,
batchSizeLimit,
diff --git a/src/Serilog.Sinks.Splunk/packages.config b/src/Serilog.Sinks.Splunk/packages.config
deleted file mode 100644
index 181dae7..0000000
--- a/src/Serilog.Sinks.Splunk/packages.config
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/src/Serilog.Sinks.Splunk/project.json b/src/Serilog.Sinks.Splunk/project.json
new file mode 100644
index 0000000..1fc7953
--- /dev/null
+++ b/src/Serilog.Sinks.Splunk/project.json
@@ -0,0 +1,48 @@
+{
+ "version": "2.0.1",
+ "description": "The Splunk Sink for Serilog",
+ "authors": [
+ "Matthew Erbs, Serilog Contributors"
+ ],
+ "packOptions": {
+ "tags": [
+ "serilog",
+ "splunk",
+ "logging",
+ "event",
+ "collector"
+ ],
+ "projectUrl": "https://github.com/serilog/serilog-sinks-splunk",
+ "licenseUrl": "http://www.apache.org/licenses/LICENSE-2.0",
+ "iconUrl": "http://serilog.net/images/serilog-sink-nuget.png"
+ },
+ "buildOptions": {
+
+ "xmlDoc": true
+ },
+ "dependencies": {
+ "Serilog": "2.0.0"
+ },
+ "frameworks": {
+ "net4.5": {
+ "buildOptions": {
+ "define": [ "TCP", "UDP" ]
+ },
+ "frameworkAssemblies": {
+ "System.Net.Http": ""
+ },
+ "dependencies": {
+ "Splunk.Logging.Common": "1.6.0"
+ }
+ },
+ "netstandard1.1": {
+ "dependencies": {
+ "System.Collections": "4.0.11",
+ "System.Collections.Concurrent": "4.0.12",
+ "System.Runtime": "4.1.0",
+ "System.Threading": "4.0.11",
+ "System.Net.Http": "4.1.0"
+ }
+ }
+ }
+}