@@ -332,8 +332,7 @@ def initialize(params)
332332 connections = *params [ 'event_hub_connections' ] # ensure array
333333 connections . each . with_index do |_connection , i |
334334 begin
335- connection = self . class . replace_placeholders ( _connection ) if self . class . respond_to? 'replace_placeholders' # 6.x
336- connection = self . class . replace_env_placeholders ( _connection ) if self . class . respond_to? 'replace_env_placeholders' # 5.x
335+ connection = replace_connection_placeholders ( _connection )
337336 event_hub_name = ConnectionStringBuilder . new ( connection ) . getEventHubName
338337 redacted_connection = connection . gsub ( /(SharedAccessKey=)([0-9a-zA-Z=+]*)([;]*)(.*)/ , '\\1<redacted>\\3\\4' )
339338 params [ 'event_hub_connections' ] [ i ] = redacted_connection # protect from leaking logs
@@ -361,6 +360,25 @@ def initialize(params)
361360
362361 attr_reader :event_hubs_exploded
363362
363+ def replace_connection_placeholders ( value )
364+ connection = value
365+ if self . class . respond_to? :replace_placeholders
366+ # Logstash 6.x
367+ if self . class . method ( :replace_placeholders ) . arity == 1
368+ connection = self . class . replace_placeholders ( connection )
369+ else
370+ # Logstash 8.15.1 and 8.15.2 changed the method arity including a new boolean parameter `refine`.
371+ # This was fixed in 8.15.3. see https://github.com/elastic/logstash/pull/16485
372+ connection = self . class . replace_placeholders ( connection , false )
373+ end
374+ end
375+
376+ # Logstash 5.x
377+ connection = self . class . replace_env_placeholders ( connection ) if self . class . respond_to? :replace_env_placeholders
378+
379+ connection
380+ end
381+
364382 def register
365383 # augment the exploded config with the defaults
366384 @event_hubs_exploded . each do |event_hub |
0 commit comments