An easy to use and high performance .NET Standard Class Library to publish events on Splunk Http Events Collector.
- NETStandard.Library v2.0.0
- Microsoft.Extensions.Configuration.Abstractions v2.0.0
- Newtonsoft.Json v10.0.3
Install-Package StoneCo.SplunkHECClient
Uninstall-Package StoneCo.SplunkHECClient
class Human
{
public int Age { get; set; }
public string Name { get; set; }
public Gender Gender { get; set; }
}
enum Gender
{
Male,
Female
}
Represents a document to add in a ISplunkHECRequest.
Represents a request to send to Splunk. Each request contains one or more documents.
Represents a response from Splunk.
Sends a request.
Signature
ISplunkHECResponse Send(ISplunkHECRequest request);
Example
ISplunkHECClientConfiguration config = new SplunkHECClientConfiguration {
Endpoint = new Uri("http://127.0.0.1:8800/services/collector"),
Token = "12161270-ba9d-478a-9cf5-8fa9b68ba239"
};
ISplunkHECClient splunkHECClient = new SplunkHECClient(config);
Human human = new Human
{
Age = 5,
Gender = Gender.Female,
Name = "Stone"
};
ISplunkHECDocument doc = new SplunkHECDocument(human);
doc.Index = "my-index";
doc.Source = "my-source";
doc.SourceType = "my-sourcetype";
doc.Host = "my-host";
doc.Time = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
ISplunkHECRequest request = new SplunkHECRequest(doc);
splunkHECClient.Send(request);
Sends a health check request to Splunk Http Events Collector.
Event raised before send the request to Splunk Http Events Collector.
Event raised after send the request to Splunk Http Events Collector.
This library is distributed under the MIT license.