Class: Fluent::GriOutput
- Defined in:
- lib/fluent/plugin/out_gri.rb
Instance Method Summary collapse
Instance Method Details
#format(tag, time, record) ⇒ Object
46 47 48 |
# File 'lib/fluent/plugin/out_gri.rb', line 46 def format tag, time, record [tag, time, record].to_msgpack end |
#start ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/fluent/plugin/out_gri.rb', line 33 def start super if @log_level ::Log.init '/tmp/out_gri.log', :log_level=>@log_level end 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' @interval ||= (GRI::Config['interval'] || 300).to_i end |
#write(chunk) ⇒ Object
50 51 52 53 54 55 56 57 58 |
# File 'lib/fluent/plugin/out_gri.rb', line 50 def write chunk records = [] chunk.msgpack_each {|tag, time, record| records.push record } writer = GRI::Writer.create 'rrd', :gra_dir=>@gra_dir, :interval=>@interval writer.write records writer.finalize end |