Class: Fluent::Plugin::GroongaLogParser

Inherits:
Parser
  • Object
show all
Defined in:
lib/fluent/plugin/parser_groonga_log.rb

Instance Method Summary collapse

Constructor Details

#initializeGroongaLogParser

Returns a new instance of GroongaLogParser.



24
25
26
27
28
# File 'lib/fluent/plugin/parser_groonga_log.rb', line 24

def initialize
  super
  @mutex = Mutex.new
  @parser = GroongaLog::Parser.new
end

Instance Method Details

#configure(conf) ⇒ Object



30
31
32
# File 'lib/fluent/plugin/parser_groonga_log.rb', line 30

def configure(conf)
  super
end

#parse(text) ⇒ Object



34
35
36
37
38
39
40
41
# File 'lib/fluent/plugin/parser_groonga_log.rb', line 34

def parse(text)
  @parser.parse(text) do |statistic|
    record = statistic.to_h
    timestamp = record.delete(:timestamp)
    event_time = Fluent::EventTime.from_time(timestamp)
    yield event_time, Hash[record.collect{|k,v| [k.to_s, v]}]
  end
end