Updated
This commit is contained in:
@@ -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"));
|
||||
|
||||
/// <summary>
|
||||
/// Instantiate the object.
|
||||
/// </summary>
|
||||
public SplunkServer()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Instantiate the object.
|
||||
/// </summary>
|
||||
/// <param name="splunkHecUrl">splunkHecUrl.</param>
|
||||
/// <param name="splunkHecToken">splunkHecToken.</param>
|
||||
public SplunkServer(string splunkHecUrl, string splunkHecToken)
|
||||
/// <param name="httpClientHandler">httpClientHandler. (optional)</param>
|
||||
public SplunkServer(string splunkHecUrl, string splunkHecToken, HttpClientHandler httpClientHandler = null)
|
||||
{
|
||||
SplunkHecUrl = splunkHecUrl;
|
||||
SplunkHecToken = splunkHecToken;
|
||||
SplunkClientHandler = httpClientHandler;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Disables SSL validation (can be used for insecure https urls)
|
||||
/// <note>This overwrites your own httpClientHandler</note>
|
||||
/// </summary>
|
||||
public void DisableSSLValidation()
|
||||
{
|
||||
HttpClientHandler clientHandler = new HttpClientHandler()
|
||||
{
|
||||
ServerCertificateCustomValidationCallback = (sender, cert, chain, sslPolicyErrors) => true
|
||||
};
|
||||
SplunkClientHandler = clientHandler;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user