Sha256: 6c541a7d74f20a80da3c6573fe08d4ce70729b8b7a77f51afa4f419c3c281a1d
Contents?: true
Size: 1.48 KB
Versions: 3
Compression:
Stored size: 1.48 KB
Contents
module Fluent class OutDatadogEvent < Fluent::Output Fluent::Plugin.register_output('datadog_event', self) unless method_defined?(:log) define_method("log") { $log } end config_param :api_key, :string config_param :app_key, :string, :default => nil config_param :msg_title, :string, :default => 'fluentd Datadog Event' config_param :priority, :string, :default => nil config_param :tags, :string, :default => nil config_param :alert_type, :string, :default => nil config_param :aggregation_key, :string, :default => nil config_param :source_type_name, :string, :default => 'fluentd' def initialize super # require "dogapi" require "date" end def start @dog = Dogapi::Client.new(@api_key, @app_key) @finished = false end def shutdown @finished = true @thread.join end def emit(tag, es, chain) chain.next es.each do |time,record| post_event(time, "record", record) end end def post_event(time, event_key, event_msg) res = @dog.emit_event(Dogapi::Event.new( "#{event_msg}", :msg_title => @msg_title, :date_happend => time, :priority => @priority, # :host => @host, :tags => @tags, :alert_type => @alert_type, :aggregation_key => @aggregation_key, :source_type_name => @source_type_name )) # for debug #puts "debug_out: #{res}\n" end end end
Version data entries
3 entries across 3 versions & 1 rubygems