class LogStash::Outputs::Airbrake

This output lets you send logs to Airbrake.

Public Instance Methods

receive(event) click to toggle source
# File lib/logstash/outputs/airbrake.rb, line 44
def receive(event)
  return unless output?(event)

  send_notice(build_notice(event))
end
register() click to toggle source
# File lib/logstash/outputs/airbrake.rb, line 32
def register
  Airbrake.configure do |c|
    c.api_key          = @api_key
    c.environment_name = @environment

    c.host   = @host if @host
    c.port   = @port if @port
    c.secure = @port.to_i == 443
  end
end

Private Instance Methods

build_notice(event) click to toggle source
# File lib/logstash/outputs/airbrake.rb, line 51
def build_notice(event)
  opts = {
    :error_class   => @error_type,
    :error_message => event['message'],
    :host          => event['host'],
    :parameters    => event.to_hash
  }

  LogStash::Outputs::Airbrake::Notice.new(
    Airbrake.configuration.merge(opts)
  )
end
send_notice(notice) click to toggle source
# File lib/logstash/outputs/airbrake.rb, line 65
def send_notice(notice)
  configuration = Airbrake.configuration
  sender = Airbrake.sender

  return unless configuration.configured? && configuration.public?

  if configuration.async?
    configuration.async.call(notice)
    nil # make sure we never set env["airbrake.error_id"] for async notices
  else
    sender.send_to_airbrake(notice)
  end
end