Parent

Included Modules

Class/Module Index [+]

Quicksearch

Fluent::TextParser::SyslogParser

Constants

REGEXP

From existence TextParser pattern

REGEXP_WITH_PRI

From in_syslog default pattern

Attributes

estimate_current_event[RW]

Public Class Methods

new() click to toggle source
# File lib/fluent/parser.rb, line 481
def initialize
  super
  @estimate_current_event = true
  @mutex = Mutex.new
end

Public Instance Methods

call(text) click to toggle source
# File lib/fluent/parser.rb, line 498
def call(text)
  m = @regexp.match(text)
  unless m
    if block_given?
      yield nil, nil
      return
    else
      return nil, nil
    end
  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(/ +/, ' ')) }
      else
        record[name] = value
      end
    end
  }

  if @estimate_current_event
    time ||= Engine.now
  end

  if block_given?
    yield time, record
  else
    return time, record
  end
end
configure(conf) click to toggle source
# File lib/fluent/parser.rb, line 487
def configure(conf)
  super

  @regexp = @with_priority ? REGEXP_WITH_PRI : REGEXP
  @time_parser = TextParser::TimeParser.new(@time_format)
end
patterns() click to toggle source
# File lib/fluent/parser.rb, line 494
def patterns
  {'format' => @regexp, 'time_format' => @time_format}
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.