From ec6774c37137b236afaa6ef336318f8d57d3e9a3 Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Mon, 23 Sep 2024 15:14:00 +0200 Subject: [PATCH] useSniffing parameter handling was flipped (#445) --- src/Elastic.Serilog.Sinks/ConfigSinkExtensions.cs | 4 ++-- src/Elastic.Serilog.Sinks/ElasticsearchSinkExtensions.cs | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Elastic.Serilog.Sinks/ConfigSinkExtensions.cs b/src/Elastic.Serilog.Sinks/ConfigSinkExtensions.cs index 94684159..30f1da55 100644 --- a/src/Elastic.Serilog.Sinks/ConfigSinkExtensions.cs +++ b/src/Elastic.Serilog.Sinks/ConfigSinkExtensions.cs @@ -28,7 +28,7 @@ public static LoggerConfiguration Elasticsearch( this LoggerSinkConfiguration loggerConfiguration, BootstrapMethod bootstrapMethod, ICollection nodes, - bool useSniffing = true, + bool useSniffing = false, string? dataStream = null, string? ilmPolicy = null, string? apiKey = null, @@ -58,7 +58,7 @@ public static LoggerConfiguration Elasticsearch( LogEventLevel restrictedToMinimumLevel = LevelAlias.Minimum ) { - var transportConfig = !useSniffing ? TransportHelper.Static(nodes) : TransportHelper.Sniffing(nodes); + var transportConfig = useSniffing ? TransportHelper.Sniffing(nodes) : TransportHelper.Static(nodes); SetTransportConfig(transportConfig, apiKey, username, password, proxy, proxyUsername, proxyPassword, fingerprint, debugMode ); diff --git a/src/Elastic.Serilog.Sinks/ElasticsearchSinkExtensions.cs b/src/Elastic.Serilog.Sinks/ElasticsearchSinkExtensions.cs index fafb58b7..659d418e 100644 --- a/src/Elastic.Serilog.Sinks/ElasticsearchSinkExtensions.cs +++ b/src/Elastic.Serilog.Sinks/ElasticsearchSinkExtensions.cs @@ -48,12 +48,12 @@ public static LoggerConfiguration Elasticsearch( ICollection nodes, Action? configureOptions = null, Action? configureTransport = null, - bool useSniffing = true, + bool useSniffing = false, LoggingLevelSwitch? levelSwitch = null, LogEventLevel restrictedToMinimumLevel = LevelAlias.Minimum ) { - var transportConfig = useSniffing ? TransportHelper.Static(nodes) : TransportHelper.Sniffing(nodes); + var transportConfig = useSniffing ? TransportHelper.Sniffing(nodes) : TransportHelper.Static(nodes) ; configureTransport?.Invoke(transportConfig); var sinkOptions = new ElasticsearchSinkOptions(new DistributedTransport(transportConfig)); @@ -73,12 +73,12 @@ public static LoggerConfiguration Elasticsearch( ICollection nodes, Action>? configureOptions = null, Action? configureTransport = null, - bool useSniffing = true, + bool useSniffing = false, LoggingLevelSwitch? levelSwitch = null, LogEventLevel restrictedToMinimumLevel = LevelAlias.Minimum ) where TEcsDocument : EcsDocument, new() { - var transportConfig = useSniffing ? TransportHelper.Static(nodes) : TransportHelper.Sniffing(nodes); + var transportConfig = useSniffing ? TransportHelper.Sniffing(nodes) : TransportHelper.Static(nodes); configureTransport?.Invoke(transportConfig); var sinkOptions = new ElasticsearchSinkOptions(new DistributedTransport(transportConfig)); configureOptions?.Invoke(sinkOptions);