diff --git a/EonaCat.Logger/Splunk/SplunkServer.cs b/EonaCat.Logger/Splunk/SplunkServer.cs
index 6be8765..7d8b311 100644
--- a/EonaCat.Logger/Splunk/SplunkServer.cs
+++ b/EonaCat.Logger/Splunk/SplunkServer.cs
@@ -1,4 +1,5 @@
using System;
+using System.Net.Http;
namespace EonaCat.Logger.SplunkServer
{
@@ -47,10 +48,11 @@ namespace EonaCat.Logger.SplunkServer
}
}
+ public HttpClientHandler SplunkClientHandler { get; internal set; }
+
internal readonly object SendLock = new object();
- private string _splunkHecUrl = "https://127.0.0.1:8088";
+ private string _splunkHecUrl = "https://127.0.0.1:8088/services/collector";
private string _splunkHecToken = "splunk-hec-token";
- private string _hostName;
public bool HasHecToken => !string.IsNullOrWhiteSpace(SplunkHecToken) && SplunkHecToken != "splunk-hec-token";
@@ -58,22 +60,31 @@ namespace EonaCat.Logger.SplunkServer
public bool IsLocalHost => HasHecUrl && (SplunkHecUrl.ToLower().Contains("127.0.0.1") || SplunkHecUrl.ToLower().Contains("localhost"));
- ///
- /// Instantiate the object.
- ///
- public SplunkServer()
- {
- }
///
/// Instantiate the object.
///
/// splunkHecUrl.
/// splunkHecToken.
- public SplunkServer(string splunkHecUrl, string splunkHecToken)
+ /// httpClientHandler. (optional)
+ public SplunkServer(string splunkHecUrl, string splunkHecToken, HttpClientHandler httpClientHandler = null)
{
SplunkHecUrl = splunkHecUrl;
SplunkHecToken = splunkHecToken;
+ SplunkClientHandler = httpClientHandler;
+ }
+
+ ///
+ /// Disables SSL validation (can be used for insecure https urls)
+ /// This overwrites your own httpClientHandler
+ ///
+ public void DisableSSLValidation()
+ {
+ HttpClientHandler clientHandler = new HttpClientHandler()
+ {
+ ServerCertificateCustomValidationCallback = (sender, cert, chain, sslPolicyErrors) => true
+ };
+ SplunkClientHandler = clientHandler;
}
}
}