Skip to content

Commit d33a53d

Browse files
committed
Use String#sub instead of String#sub!
Because String#sub! is a destructive method. Built-in in_tail plugin will configure the parse section twice. The in_tail plugin will use raw parse section at the 1st time and it will use parse section with expanded grok pattern without types. We can avoid this behavior when we stop using a destructive method to expand grok patterns. Signed-off-by: Kenji Okimoto <okimoto@clear-code.com>
1 parent 6832a3d commit d33a53d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/fluent/plugin/grok.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def expand_pattern(pattern)
131131
else
132132
replacement_pattern = "(?:#{curr_pattern})"
133133
end
134-
pattern.sub!(m[0]) do |s|
134+
pattern = pattern.sub(m[0]) do |s|
135135
replacement_pattern
136136
end
137137
end

0 commit comments

Comments
 (0)