Skip to content

Commit 74a1a6d

Browse files
committed
Readme and doco work
1 parent be9ae5f commit 74a1a6d

File tree

14 files changed

+88
-57
lines changed

14 files changed

+88
-57
lines changed

CHANGES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
- Moved the sink from its [original location](https://github.com/serilog/serilog)
33
**1.5.30**
44
- Added switch for template rendering
5-
**2.0**
5+
**1.6**
66
- Added support for Splunk 6.3 Event Collector
77
- Deprecated Splunk HTTP Sink using Management Port/API

README.md

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,40 +17,27 @@ To get started install the *Serilog.Sinks.Splunk* package from Visual Studio's *
1717
PM> Install-Package Serilog.Sinks.Splunk
1818
```
1919

20-
Set up to log via TCP
20+
Using the new Event Collector in Splunk 6.3
2121

22-
```csharp
22+
```csharp
2323
var log = new LoggerConfiguration()
24-
.WriteTo.SplunkViaTcp("127.0.0.1", 10001)
24+
.WriteTo.SplunkViaEventCollector("https://mysplunk:8088/services/collector", "myeventcollectortoken")
2525
.CreateLogger();
2626
```
2727

28-
Or maybe UDP
28+
Set up to log via TCP
2929

3030
```csharp
3131
var log = new LoggerConfiguration()
32-
.WriteTo.SplunkViaUdp("127.0.0.1", 10000)
32+
.WriteTo.SplunkViaTcp("127.0.0.1", 10001)
3333
.CreateLogger();
3434
```
3535

36-
Or maybe HTTP
36+
Or maybe UDP
3737

3838
```csharp
39-
var generalSplunkContext = new Context(Scheme.Https, "127.0.0.1", 8089);
40-
41-
var transmitterArgs = new TransmitterArgs
42-
{
43-
Source = "Splunk.Sample",
44-
SourceType = "Splunk Sample Source"
45-
};
46-
47-
const string username = "my splunk user";
48-
const string password = "my splunk password";
49-
const string splunkIndex = "mysplunktest";
50-
51-
var serilogContext = new SplunkContext(generalSplunkContext, splunkIndex, username, password, null, transmitterArgs);
52-
5339
var log = new LoggerConfiguration()
54-
.WriteTo.SplunkViaHttp(serilogContext, 10, TimeSpan.FromSeconds(5))
40+
.WriteTo.SplunkViaUdp("127.0.0.1", 10000)
5541
.CreateLogger();
5642
```
43+

sample/Serilog.Sinks.Splunk.Sample/Program.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ public void Configure()
3232
{
3333
ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true;
3434

35-
3635
Log.Logger = new LoggerConfiguration()
3736
.WriteTo.LiterateConsole()
3837
.WriteTo.SplunkViaEventCollector("https://mysplunk:8088/services/collector", "685546AE-0278-4786-97C4-5971676D5D70")

serilog-sinks-splunk.sln

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio 2013
4-
VisualStudioVersion = 12.0.31101.0
3+
# Visual Studio 14
4+
VisualStudioVersion = 14.0.23107.0
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Serilog.Sinks.Splunk", "src\Serilog.Sinks.Splunk\Serilog.Sinks.Splunk.csproj", "{1493ABC3-811C-46C7-92ED-CEB7567FB588}"
77
EndProject
@@ -12,6 +12,7 @@ EndProject
1212
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "assets", "assets", "{B9B13339-749C-4098-8845-780ED4FA488A}"
1313
ProjectSection(SolutionItems) = preProject
1414
Build.ps1 = Build.ps1
15+
CHANGES.md = CHANGES.md
1516
assets\CommonAssemblyInfo.cs = assets\CommonAssemblyInfo.cs
1617
README.md = README.md
1718
assets\Serilog.snk = assets\Serilog.snk

src/Serilog.Sinks.Splunk.FullNetFx/LoggerConfigurationSplunkExtensions.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public static LoggerConfiguration SplunkViaEventCollector(
5353
if (sinkConfiguration == null) throw new ArgumentNullException(nameof(sinkConfiguration));
5454
if (outputTemplate == null) throw new ArgumentNullException(nameof(outputTemplate));
5555
var formatter = new MessageTemplateTextFormatter(outputTemplate, formatProvider);
56-
return sinkConfiguration.Sink(new SplunkViaEventCollectorSink(splunkHost, eventCollectorToken), restrictedToMinimumLevel);
56+
return sinkConfiguration.Sink(new EventCollectorSink(splunkHost, eventCollectorToken), restrictedToMinimumLevel);
5757
}
5858

5959

@@ -76,7 +76,7 @@ public static LoggerConfiguration SplunkViaUdp(
7676
IFormatProvider formatProvider = null,
7777
bool renderTemplate = true)
7878
{
79-
var sink = new SplunkViaUdpSink(host, port, formatProvider, renderTemplate);
79+
var sink = new UdpSink(host, port, formatProvider, renderTemplate);
8080

8181
return loggerConfiguration.Sink(sink, restrictedToMinimumLevel);
8282
}
@@ -101,7 +101,7 @@ public static LoggerConfiguration SplunkViaUdp(
101101
IFormatProvider formatProvider = null,
102102
bool renderTemplate = true)
103103
{
104-
var sink = new SplunkViaUdpSink(hostAddresss, port, formatProvider, renderTemplate);
104+
var sink = new UdpSink(hostAddresss, port, formatProvider, renderTemplate);
105105

106106
return loggerConfiguration.Sink(sink, restrictedToMinimumLevel);
107107
}
@@ -125,7 +125,7 @@ public static LoggerConfiguration SplunkViaTcp(
125125
IFormatProvider formatProvider = null,
126126
bool renderTemplate = true)
127127
{
128-
var sink = new SplunkViaTcpSink(hostAddresss, port, formatProvider, renderTemplate);
128+
var sink = new TcpSink(hostAddresss, port, formatProvider, renderTemplate);
129129

130130
return loggerConfiguration.Sink(sink, restrictedToMinimumLevel);
131131
}
@@ -149,7 +149,7 @@ public static LoggerConfiguration SplunkViaTcp(
149149
IFormatProvider formatProvider = null,
150150
bool renderTemplate = true)
151151
{
152-
var sink = new SplunkViaTcpSink(host, port, formatProvider, renderTemplate);
152+
var sink = new TcpSink(host, port, formatProvider, renderTemplate);
153153

154154
return loggerConfiguration.Sink(sink, restrictedToMinimumLevel);
155155
}

src/Serilog.Sinks.Splunk.FullNetFx/Serilog.Sinks.Splunk.FullNetFx.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,22 +65,22 @@
6565
<Compile Include="..\Serilog.Sinks.Splunk\Sinks\Splunk\EventCollectorExtensions.cs">
6666
<Link>Sinks\Splunk\EventCollectorExtensions.cs</Link>
6767
</Compile>
68+
<Compile Include="..\Serilog.Sinks.Splunk\Sinks\Splunk\EventCollectorSink.cs">
69+
<Link>Sinks\Splunk\EventCollectorSink.cs</Link>
70+
</Compile>
6871
<Compile Include="..\Serilog.Sinks.Splunk\Sinks\Splunk\RepeatAction.cs">
6972
<Link>Sinks\Splunk\RepeatAction.cs</Link>
7073
</Compile>
7174
<Compile Include="..\Serilog.Sinks.Splunk\Sinks\Splunk\SplunkJsonFormatter.cs">
7275
<Link>Sinks\Splunk\SplunkJsonFormatter.cs</Link>
7376
</Compile>
74-
<Compile Include="..\Serilog.Sinks.Splunk\Sinks\Splunk\SplunkViaEventCollectorSink.cs">
75-
<Link>Sinks\Splunk\SplunkViaEventCollectorSink.cs</Link>
76-
</Compile>
7777
<Compile Include="Properties\AssemblyInfo.cs" />
7878
<Compile Include="..\..\assets\CommonAssemblyInfo.cs">
7979
<Link>Properties\CommonAssemblyInfo.cs</Link>
8080
</Compile>
8181
<Compile Include="LoggerConfigurationSplunkExtensions.cs" />
82-
<Compile Include="Sinks\Splunk\SplunkViaTcpSink.cs" />
83-
<Compile Include="Sinks\Splunk\SplunkViaUdpSink.cs" />
82+
<Compile Include="Sinks\Splunk\TcpSink.cs" />
83+
<Compile Include="Sinks\Splunk\UdpSink.cs" />
8484
</ItemGroup>
8585
<ItemGroup>
8686
<None Include="packages.config" />

src/Serilog.Sinks.Splunk.FullNetFx/Sinks/Splunk/SplunkViaTcpSink.cs renamed to src/Serilog.Sinks.Splunk.FullNetFx/Sinks/Splunk/TcpSink.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ namespace Serilog.Sinks.Splunk
2727
/// <summary>
2828
/// A sink that logs to Splunk over TCP
2929
/// </summary>
30-
public class SplunkViaTcpSink : ILogEventSink, IDisposable
30+
public class TcpSink : ILogEventSink, IDisposable
3131
{
3232
readonly JsonFormatter _jsonFormatter;
3333
private TcpSocketWriter _writer;
@@ -40,7 +40,7 @@ public class SplunkViaTcpSink : ILogEventSink, IDisposable
4040
/// <param name="formatProvider">Optional format provider</param>
4141
/// <param name="renderTemplate">If true, the message template will be rendered</param>
4242

43-
public SplunkViaTcpSink(
43+
public TcpSink(
4444
IPAddress hostAddress,
4545
int port,
4646
IFormatProvider formatProvider = null,
@@ -60,7 +60,7 @@ public SplunkViaTcpSink(
6060
/// <param name="port">The UDP port configured in Splunk</param>
6161
/// <param name="formatProvider">Optional format provider</param>
6262
/// <param name="renderTemplate">If true, the message template will be rendered</param>
63-
public SplunkViaTcpSink(
63+
public TcpSink(
6464
string host,
6565
int port,
6666
IFormatProvider formatProvider = null,

src/Serilog.Sinks.Splunk.FullNetFx/Sinks/Splunk/SplunkViaUdpSink.cs renamed to src/Serilog.Sinks.Splunk.FullNetFx/Sinks/Splunk/UdpSink.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ namespace Serilog.Sinks.Splunk
2626
/// <summary>
2727
/// A sink that logs to Splunk over Udp
2828
/// </summary>
29-
public class SplunkViaUdpSink : ILogEventSink, IDisposable
29+
public class UdpSink : ILogEventSink, IDisposable
3030
{
3131
readonly Socket _socket;
3232
readonly JsonFormatter _jsonFormatter;
@@ -38,7 +38,7 @@ public class SplunkViaUdpSink : ILogEventSink, IDisposable
3838
/// <param name="port">The UDP port configured in Splunk</param>
3939
/// <param name="formatProvider">Optional format provider</param>
4040
/// <param name="renderTemplate">If true, the message template will be rendered</param>
41-
public SplunkViaUdpSink(IPAddress hostAddress, int port, IFormatProvider formatProvider = null, bool renderTemplate = true)
41+
public UdpSink(IPAddress hostAddress, int port, IFormatProvider formatProvider = null, bool renderTemplate = true)
4242
{
4343
_socket = new Socket(SocketType.Dgram, ProtocolType.Udp);
4444
_socket.Connect(hostAddress, port);
@@ -53,7 +53,7 @@ public SplunkViaUdpSink(IPAddress hostAddress, int port, IFormatProvider formatP
5353
/// <param name="port">The UDP port configured in Splunk</param>
5454
/// <param name="formatProvider">Optional format provider</param>
5555
/// <param name="renderTemplate">If true, the message template is rendered</param>
56-
public SplunkViaUdpSink(string host, int port, IFormatProvider formatProvider = null,
56+
public UdpSink(string host, int port, IFormatProvider formatProvider = null,
5757
bool renderTemplate = true)
5858
{
5959
_socket = new Socket(SocketType.Dgram, ProtocolType.Udp);

src/Serilog.Sinks.Splunk/LoggerConfigurationSplunkExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public static LoggerConfiguration SplunkViaEventCollector(
5151
if (sinkConfiguration == null) throw new ArgumentNullException(nameof(sinkConfiguration));
5252
if (outputTemplate == null) throw new ArgumentNullException(nameof(outputTemplate));
5353
var formatter = new MessageTemplateTextFormatter(outputTemplate, formatProvider);
54-
return sinkConfiguration.Sink(new SplunkViaEventCollectorSink(splunkHost, eventCollectorToken), restrictedToMinimumLevel);
54+
return sinkConfiguration.Sink(new EventCollectorSink(splunkHost, eventCollectorToken), restrictedToMinimumLevel);
5555
}
5656
}
5757
}

src/Serilog.Sinks.Splunk/Serilog.Sinks.Splunk.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
<Compile Include="Sinks\Splunk\RepeatAction.cs" />
5858
<Compile Include="Sinks\Splunk\SplunkJsonFormatter.cs" />
5959
<Compile Include="Sinks\Splunk\EventCollectorExtensions.cs" />
60-
<Compile Include="Sinks\Splunk\SplunkViaEventCollectorSink.cs" />
60+
<Compile Include="Sinks\Splunk\EventCollectorSink.cs" />
6161
</ItemGroup>
6262
<ItemGroup>
6363
<Reference Include="Serilog, Version=1.5.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10, processorArchitecture=MSIL">

0 commit comments

Comments
 (0)