Skip to content

Commit de1a3f7

Browse files
committed
Added simple examples similar to Seq
1 parent cfffbbd commit de1a3f7

File tree

1 file changed

+41
-1
lines changed

1 file changed

+41
-1
lines changed

README.md

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# serilog-sinks-splunk
2+
[![Package Logo](http://serilog.net/images/serilog-sink-nuget.png)](http://nuget.org/packages/serilog.sinks.splunk)
23

34
[![Build status](https://ci.appveyor.com/api/projects/status/yt40wg34t8oj61al?svg=true)](https://ci.appveyor.com/project/serilog/serilog-sinks-splunk)
45
[![NuGet Version](http://img.shields.io/nuget/v/Serilog.Sinks.Splunk.svg?style=flat)](https://www.nuget.org/packages/Serilog.Sinks.Splunk/)
@@ -8,9 +9,48 @@ A sink for Serilog that writes events to [Splunk](https://splunk.com). Moved fro
89
**Package** - [Serilog.Sink.Splunk](http://nuget.org/packages/serilog.sink.splunk)
910
| **Platforms** - .NET 4.5+, PCL
1011

12+
## Getting started
13+
14+
To get started install the *Serilog.Sinks.Seq* package from Visual Studio's *NuGet* console:
15+
16+
```powershell
17+
PM> Install-Package Serilog.Sinks.Splunk
18+
```
19+
20+
Set up to log via TCP
21+
1122
```csharp
1223
var log = new LoggerConfiguration()
13-
.WriteTo.SplunkViaUdp("127.0.0.1", 10000)
1424
.WriteTo.SplunkViaTcp("127.0.0.1", 10001)
1525
.CreateLogger();
1626
```
27+
28+
Or maybe UDP
29+
30+
```csharp
31+
var log = new LoggerConfiguration()
32+
.WriteTo.SplunkViaUdp("127.0.0.1", 10000)
33+
.CreateLogger();
34+
```
35+
36+
Or maybe HTTP
37+
38+
```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+
53+
var log = new LoggerConfiguration()
54+
.WriteTo.SplunkViaHttp(serilogContext, 10, TimeSpan.FromSeconds(5))
55+
.CreateLogger();
56+
```

0 commit comments

Comments
 (0)