lib/fluent/plugin/grok.rb in fluent-plugin-grok-parser-2.0.1 vs lib/fluent/plugin/grok.rb in fluent-plugin-grok-parser-2.1.0
- old
+ new
@@ -31,10 +31,10 @@
@multiline_start_regexp = Regexp.compile(@conf["multiline_start_regexp"][1..-2])
end
end
def add_patterns_from_file(path)
- File.new(path).each_line do |line|
+ File.open(path, "r").each_line do |line|
next if line[0] == "#" || /^$/ =~ line
name, pat = line.chomp.split(/\s+/, 2)
@pattern_map[name] = pat
end
end