|
1 | 1 | # Serilog.Sinks.Splunk
|
2 | 2 |
|
3 |
| -[](https://ci.appveyor.com/project/serilog/serilog-sinks-splunk) |
4 |
| -[](https://www.nuget.org/packages/Serilog.Sinks.Splunk/) |
| 3 | +[](https://ci.appveyor.com/project/serilog/serilog-sinks-splunk)  |
5 | 4 | [](https://gitter.im/serilog/serilog)
|
6 | 5 |
|
7 | 6 | A Serilog sink that writes events to the [Splunk](https://splunk.com). Supports .NET 4.5+, .NET Core, and platforms compatible with the [.NET Platform Standard](https://github.com/dotnet/corefx/blob/master/Documentation/architecture/net-platform-standard.md) 1.1 including Windows 8 & UWP, Windows Phone and Xamarin.
|
8 | 7 |
|
9 |
| -[](http://nuget.org/packages/serilog.sinks.splunk) |
| 8 | +[](https://nuget.org/packages/serilog.sinks.splunk) |
10 | 9 |
|
11 |
| -**Package** - [Serilog.Sinks.Splunk](http://nuget.org/packages/serilog.sinks.splunk) |
| 10 | +**Package** - [Serilog.Sinks.Splunk](https://nuget.org/packages/serilog.sinks.splunk) |
12 | 11 |
|
13 | 12 | ## Getting started
|
14 | 13 |
|
15 |
| -To get started install the *Serilog.Sinks.Splunk* package from Visual Studio's *NuGet* console: |
| 14 | +To get started install the *Serilog.Sinks.Splunk* package: |
16 | 15 |
|
17 | 16 | ```powershell
|
18 | 17 | PM> Install-Package Serilog.Sinks.Splunk
|
19 | 18 | ```
|
20 | 19 |
|
21 |
| -Using the Event Collector (Splunk 6.3 and above) |
| 20 | +OR |
22 | 21 |
|
23 |
| -```csharp |
| 22 | +```bash |
| 23 | +$ dotnet add package Serilog.Sinks.Splunk |
| 24 | +``` |
| 25 | + |
| 26 | +If using the `TCP` or `UDP` sinks install the following packages |
| 27 | + |
| 28 | +* TCP: `Serilog.Sinks.Splunk.TCP` |
| 29 | +* UDP: `Serilog.Sinks.Splunk.UDP` |
| 30 | + |
| 31 | +To start using the Splunk Event Collector (Splunk 6.3 and above), logging can be setup as follows. |
| 32 | + |
| 33 | +```csharp |
24 | 34 | var log = new LoggerConfiguration()
|
25 |
| - .WriteTo.EventCollector("https://mysplunk:8088/services/collector", "myeventcollectortoken") |
| 35 | + .WriteTo.EventCollector("https://mysplunk:8088/services/collector", "myeventcollectortoken") |
26 | 36 | .CreateLogger();
|
27 | 37 | ```
|
28 | 38 |
|
29 |
| -More information is available on the [wiki](https://github.com/serilog/serilog-sinks-splunk/wiki). |
| 39 | +If using `appsettings.json` for configuration the following example illustrates using the Event Collector and Console sinks. |
| 40 | + |
| 41 | +```javascript |
| 42 | +{ |
| 43 | + "Serilog": { |
| 44 | + "Using": ["Serilog.Sinks.Console", "Serilog.Sinks.Splunk"], |
| 45 | + "MinimumLevel": "Information", |
| 46 | + "WriteTo": [{ |
| 47 | + "Name": "Console" |
| 48 | + }, |
| 49 | + { |
| 50 | + "Name": "EventCollector", |
| 51 | + "Args": { |
| 52 | + "splunkHost": "http://splunk:8088", |
| 53 | + "eventCollectorToken": "00112233-4455-6677-8899-AABBCCDDEEFF" |
| 54 | + } |
| 55 | + } |
| 56 | + ], |
| 57 | + "Properties": { |
| 58 | + "Application": "Serilog Splunk Console Sample" |
| 59 | + } |
| 60 | + } |
| 61 | +} |
| 62 | +``` |
30 | 63 |
|
| 64 | +More information about Serilog is available on the [wiki](https://github.com/serilog/serilog-sinks-splunk/wiki). |
31 | 65 | ### Build status
|
32 | 66 |
|
33 | 67 | Branch | AppVeyor | Travis
|
|
0 commit comments