class Fluent::Plugin::SyslogParser
Constants
- REGEXP
From existence TextParser pattern
- REGEXP_WITH_PRI
From in_syslog default pattern
Public Class Methods
new()
click to toggle source
Calls superclass method
Fluent::Plugin::Parser.new
# File lib/fluent/plugin/parser_syslog.rb, line 34 def initialize super @mutex = Mutex.new end
Public Instance Methods
configure(conf)
click to toggle source
Calls superclass method
Fluent::Plugin::Base#configure
# File lib/fluent/plugin/parser_syslog.rb, line 39 def configure(conf) super @regexp = @with_priority ? REGEXP_WITH_PRI : REGEXP @time_parser = time_parser_create end
parse(text) { |nil, nil| ... }
click to toggle source
# File lib/fluent/plugin/parser_syslog.rb, line 50 def parse(text) m = @regexp.match(text) unless m yield nil, nil return end time = nil record = {} m.names.each { |name| if value = m[name] case name when "pri" record['pri'] = value.to_i when "time" time = @mutex.synchronize { @time_parser.parse(value.gsub(/ +/, ' ')) } record[name] = value if @keep_time_key else record[name] = value end end } if @estimate_current_event time ||= Fluent::EventTime.now end yield time, record end
patterns()
click to toggle source
# File lib/fluent/plugin/parser_syslog.rb, line 46 def patterns {'format' => @regexp, 'time_format' => @time_format} end