class Fluent::RavenDecoderOutput

Public Class Methods

new() click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_raven_decoder.rb, line 16
def initialize
  super
  require 'base64'
  require 'zlib'
  require 'multi_json'
end

Public Instance Methods

configure(conf) click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_raven_decoder.rb, line 31
def configure(conf)
  super
end
emit(tag, es, chain) click to toggle source
# File lib/fluent/plugin/out_raven_decoder.rb, line 35
def emit(tag, es, chain)
  new_tag = @prefix + '.' + tag

  es.each do |time, record|
    data = record[@data_field]

    if data
      data = decode(data)
      router.emit(new_tag, time, data)
    else
      log.warn("Raven data is not included: tag:#{new_tag} record:#{record.inspect}")
    end
  end

  chain.next
rescue => e
  log.error(e.message + "\n" + e.backtrace.first)
end
shutdown() click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_raven_decoder.rb, line 27
def shutdown
  super
end
start() click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_raven_decoder.rb, line 23
def start
  super
end

Private Instance Methods

decode(data) click to toggle source
# File lib/fluent/plugin/out_raven_decoder.rb, line 56
def decode(data)
  data = Base64.strict_decode64(data)
  data = Zlib::Inflate.inflate(data)
  data = MultiJson.load(data)

  @ignore_fields.each do |field|
    data.delete(field)
  end

  data
end