lib/fluent/plugin/grok.rb in fluent-plugin-grok-parser-2.5.1 vs lib/fluent/plugin/grok.rb in fluent-plugin-grok-parser-2.6.0
- old
+ new
@@ -25,10 +25,12 @@
@pattern_map = {}
@parsers = {}
@multiline_mode = false
@conf = conf
@plugin = plugin
+ @time_format = nil
+ @timezone = nil
if @plugin.respond_to?(:firstline?)
@multiline_mode = true
end
if @plugin.respond_to?(:multiline_start_regexp) && @plugin.multiline_start_regexp
@multiline_start_regexp = Regexp.compile(@plugin.multiline_start_regexp[1..-2])
@@ -37,10 +39,13 @@
@keep_time_key = @plugin.keep_time_key
end
if @plugin.respond_to?(:time_format)
@time_format = @plugin.time_format
end
+ if @plugin.respond_to?(:timezone)
+ @timezone = @plugin.timezone
+ end
end
def add_patterns_from_file(path)
File.open(path, "r:utf-8:utf-8").each_line do |line|
next if line[0] == "#" || /^$/ =~ line
@@ -102,9 +107,12 @@
if conf["time_key"]
_conf["time_key"] = conf["time_key"]
end
if conf["time_format"] || @time_format
_conf["time_format"] = conf["time_format"] || @time_format
+ end
+ if conf["timezone"] || @timezone
+ _conf["timezone"] = conf["timezone"] || @timezone
end
_conf["expression"] = regexp
config = Fluent::Config::Element.new("parse", "", _conf, [])
parser = Fluent::Plugin::RegexpParser.new
parser.configure(config)