示例#1
0
 public BpSplunkSink(BpSplunkInfo splunkInfo, ConcurrentBag <LogEvent> logs = null, Timer timer = null,
                     HttpClient httpClient = null)
     : base(httpClient ?? new HttpClient(), timer, logs)
 {
     _basicAuth  = CreateBasicAuth(splunkInfo);
     _splunkInfo = splunkInfo;
 }
示例#2
0
        private AuthenticationHeaderValue CreateBasicAuth(BpSplunkInfo splunkInfo)
        {
            string usernamePassword = $"{splunkInfo.Username}:{splunkInfo.Password}";

            byte[] encodedBytes = Encoding.UTF8.GetBytes(usernamePassword);

            return(new AuthenticationHeaderValue("Basic", Convert.ToBase64String(encodedBytes)));
        }
 public static LoggerConfiguration BpSplunkSink(
     this LoggerSinkConfiguration loggerConfiguration,
     BpSplunkInfo splunkInfo, ConcurrentBag <LogEvent> logs = null, Timer timer = null,
     HttpClient httpClient = null, LogEventLevel restrictedToMinimumLevel       = LogEventLevel.Information)
 {
     return(loggerConfiguration.Sink(new BpSplunkSink(splunkInfo, logs, timer, httpClient),
                                     restrictedToMinimumLevel));
 }