Class: Fluent::GroongaQueryLogFilter

Inherits:
Filter
  • Object
show all
Defined in:
lib/fluent/plugin/filter_groonga_query_log.rb

Instance Method Summary collapse

Instance Method Details

#configure(conf) ⇒ Object



30
31
32
33
34
# File 'lib/fluent/plugin/filter_groonga_query_log.rb', line 30

def configure(conf)
  super

  @parser = Groonga::QueryLog::Parser.new
end

#filter_stream(tag, event_stream) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/fluent/plugin/filter_groonga_query_log.rb', line 36

def filter_stream(tag, event_stream)
  statistics_event_stream = MultiEventStream.new
  event_stream.each do |time, record|
    raw_data = record[@raw_data_column_name]
    next if raw_data.nil?
    @parser.parse(raw_data) do |statistic|
      statistic_record = create_record(statistic)
      statistics_event_stream.add(time, statistic_record)
    end
  end
  statistics_event_stream
end