Class: Fluent::GriOutput

Inherits:
BufferedOutput
  • Object
show all
Defined in:
lib/fluent/plugin/out_gri.rb

Instance Method Summary collapse

Instance Method Details

#format(tag, time, record) ⇒ Object



41
42
43
# File 'lib/fluent/plugin/out_gri.rb', line 41

def format tag, time, record
  [tag, time, record].to_msgpack
end

#startObject



31
32
33
34
35
36
37
38
39
# File 'lib/fluent/plugin/out_gri.rb', line 31

def start
  super
  #::Log.init '/tmp/fluent.log'
  GRI::Config.init @config_path
  root_dir = GRI::Config['root-dir'] ||= GRI::Config::ROOT_PATH
  plugin_dirs = GRI::Config.getvar('plugin-dir') || [root_dir + '/plugin']
  GRI::Plugin.load_plugins plugin_dirs
  @gra_dir ||= GRI::Config['gra-dir'] || root_dir + '/gra'
end

#write(chunk) ⇒ Object



45
46
47
48
49
50
51
52
53
# File 'lib/fluent/plugin/out_gri.rb', line 45

def write chunk
  records = []
  chunk.msgpack_each {|tag, time, record|
    records.push record
  }
  writer = GRI::Writer.create 'rrd', :gra_dir=>@gra_dir
  writer.write records
  writer.finalize
end