logstash-core/lib/logstash/modules/logstash_config.rb
# For a first version we are copying the values of the original hash,
# this might become problematic if we users changes the values of the
# settings in the template, which could result in an inconsistent view of the original data
#
# For v1 of the feature I think its an OK compromise, v2 we have a more advanced hash that
# support alias.
For a first version we are copying the values of the original hash,
this might become problematic if we users changes the values of the
settings in the template, which could result in an inconsistent view of the original data

For v1 of the feature I think its an OK compromise, v2 we have a more advanced hash that
support alias.
For a first version we are copying the values of the original hash this might become problematic if we users changes the values of the settings in the template which could result in an inconsistent view of the original data For v1 of the feature I think its an OK compromise v2 we have a more advanced hash that support alias .
def alias_matching_keys(aliases, target)
    aliased_target = target.dup
    aliases.each do |matching_key_prefix, new_key_prefix|
      target.each do |k, v|
        re = /^#{matching_key_prefix}\./
        if k =~ re
          alias_key = k.gsub(re, "#{new_key_prefix}.")
          raise "Cannot create an alias, the destination key has already a value set: original key: #{k}, alias key: #{alias_key}" if (!aliased_target[alias_key].nil? && aliased_target[alias_key] != v)
          aliased_target[alias_key] = v unless v.nil?
        end
      end
    end
    aliased_target
  end
def alias_matching_keys ( aliases , target ) aliased_target = target . dup aliases . each do | matching_key_prefix , new_key_prefix | target . each do | k , v | re = / ^ #{ matching_key_prefix } \. / if k =~ re alias_key = k . gsub ( re , "#{new_key_prefix}." ) raise "Cannot create an alias, the destination key has already a value set: original key: #{k}, alias key: #{alias_key}" if ( ! aliased_target [ alias_key ] . nil? && aliased_target [ alias_key ] != v ) aliased_target [ alias_key ] = v unless v . nil? end end end aliased_target end
For a first version we are copying the values of the original hash,
this might become problematic if we users changes the values of the
settings in the template, which could result in an inconsistent view of the original data
For a first version we are copying the values of the original hash this might become problematic if we users changes the values of the settings in the template which could result in an inconsistent view of the original data
# If the user setup the same values twices with different values lets just halt.
aliases
<not_specific>
target
<not_specific>