Skip to content

Commit c293465

Browse files
committed
Replacement operation is valid only on String and is in brackets.
1 parent 63ad17d commit c293465

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

logstash-core/lib/logstash/util/substitution_variables.rb

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,13 @@ def replace_placeholders(value)
7474
raise LogStash::ConfigurationError, "Cannot evaluate `#{placeholder}`. Replacement variable `#{name}` is not defined in a Logstash secret store " +
7575
"or as an Environment entry and there is no default value given."
7676
end
77-
# if array string, remove literal brackets and make array
78-
replacements = replacement.gsub(/[\[\]]/, '')
79-
return replacements.split(', ').map(&:strip)
77+
# if ENV carries array string, remove literal brackets and make array
78+
if replacement.is_a?(String) && replacement.start_with?('[') && replacement.end_with?(']')
79+
replacements = replacement.gsub(/[\[\]]/, '')
80+
return replacements.split(', ').map(&:strip)
81+
else
82+
replacement.to_s
83+
end
8084
end
8185
end # def replace_placeholders
8286

0 commit comments

Comments
 (0)