public ElasticSearchAppender(IElasticClientFactory clientFactory, LogEventSmartFormatter indexName, LogEventSmartFormatter indexType, IIndexingTimer timer, ITolerateCallsFactory tolerateCallsFactory, ILogBulkSet bulk, ILogEventConverterFactory logEventConverterFactory, ElasticAppenderFilters elasticFilters, IFileAccessor fileAccessor, IExternalEventWriter eventWriter) { _logEventConverterFactory = logEventConverterFactory; _elasticClientFactory = clientFactory; IndexName = indexName; IndexType = indexType; _timer = timer; _timer.Elapsed += (o, e) => DoIndexNow(); _tolerateCallsFactory = tolerateCallsFactory; _bulk = bulk; _fileAccessor = fileAccessor; _eventWriter = eventWriter; FixedFields = FixFlags.Partial; SerializeObjects = true; BulkSize = 2000; BulkIdleTimeout = 5000; DropEventsOverBulkLimit = false; TotalDropEventLimit = null; TimeoutToWaitForTimer = 5000; ElasticSearchTimeout = 10000; IndexAsync = true; Template = null; AllowSelfSignedServerCert = false; Ssl = false; _tolerateCalls = _tolerateCallsFactory.Create(0); Servers = new ServerDataCollection(); ElasticFilters = elasticFilters; AuthenticationMethod = new AuthenticationMethodChooser(); IndexOperationParams = new IndexOperationParamsDictionary(); }
public ElasticSearchAppender() { FixedFields = FixFlags.Partial; SerializeObjects = true; BulkSize = 2000; BulkIdleTimeout = 5000; DropEventsOverBulkLimit = false; TimeoutToWaitForTimer = 5000; _tolerateCalls = new TolerateCallsBase(); Servers = new ServerDataCollection(); ElasticSearchTimeout = 10000; //DatePostfixFormat = "yyyy.MM.dd"; IndexName = $"LogEvent-{DatePostfixFormat}"; IndexType = "LogEvent"; IndexAsync = true; Template = null; LogEventFactory = new BasicLogEventFactory(); _timer = new Timer(TimerElapsed, null, Timeout.Infinite, Timeout.Infinite); ElasticFilters = new ElasticAppenderFilters(); AllowSelfSignedServerCert = false; Ssl = false; AuthenticationMethod = new AuthenticationMethodChooser(); IndexOperationParams = new IndexOperationParamsDictionary(); }
public ElasticSearchAppender() { DocumentIdSource = null; FixedFields = FixFlags.Partial; SerializeObjects = true; BulkSize = 2000; BulkIdleTimeout = 5000; TimeoutToWaitForTimer = 5000; Servers = new ServerDataCollection(); ElasticSearchTimeout = 10000; IndexName = "LogEvent-%{+yyyy.MM.dd}"; IndexType = "LogEvent"; IndexAsync = true; Template = null; LogEventFactory = new BasicLogEventFactory(); _timer = new Timer(TimerElapsed, null, Timeout.Infinite, Timeout.Infinite); ElasticFilters = new ElasticAppenderFilters(); AllowSelfSignedServerCert = false; Ssl = false; AuthenticationMethod = new AuthenticationMethodChooser(); }
public WebElasticClient(ServerDataCollection servers, int timeout, bool ssl, bool allowSelfSignedServerCert, AuthenticationMethodChooser authenticationMethod) : base(servers, timeout, ssl, allowSelfSignedServerCert, authenticationMethod) { if (Ssl && AllowSelfSignedServerCert) { ServicePointManager.ServerCertificateValidationCallback += AcceptSelfSignedServerCertCallback; } }
protected AbstractWebElasticClient(ServerDataCollection servers, int timeout, bool ssl, bool allowSelfSignedServerCert, AuthenticationMethodChooser authenticationMethod) { Servers = servers; Timeout = timeout; ServicePointManager.Expect100Continue = false; // SSL related properties Ssl = ssl; AllowSelfSignedServerCert = allowSelfSignedServerCert; AuthenticationMethod = authenticationMethod; }
public WebElasticClient(ServerDataCollection servers, int timeout, bool ssl, bool allowSelfSignedServerCert, AuthenticationMethodChooser authenticationMethod) : base(servers, timeout, ssl, allowSelfSignedServerCert, authenticationMethod) { if (Ssl && AllowSelfSignedServerCert) { ServicePointManager.ServerCertificateValidationCallback += AcceptSelfSignedServerCertCallback; } _restClientByHost = servers.ToDictionary(GetServerUrl, serverData => new RestClient(GetServerUrl(serverData)) { Timeout = timeout, Authenticator = authenticationMethod }); }
public void Ssl_should_create_https() { const string expectedUrl = "https://server:8080/"; var servers = new ServerDataCollection() { new ServerData() { Address = "server", Port = 8080, Path = "" } }; var credentials = new AuthenticationMethodChooser(); credentials.AddBasic(new BasicAuthenticationMethod() { Username = "******", Password = "******" }); var client = new WebElasticClient(servers, 10000, true, true, credentials); Assert.AreEqual(expectedUrl, client.Url); }