Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Customizing your airbrake.rb

mmcdaris edited this page · 13 revisions

A Basic airbrake.rb file should look at least like the following:

Airbrake.configure do |config|
  config.api_key = '********************************'
end

Note: Extra options are configured by adding extra lines to the above block

Collect Errors from your Development Environment

config.development_environments = []

Set a custom environment name

the default will be taken from Rails.env
you can overwrite this if it will be useful for your deployment.

config.environment_name = "test"

Ignoring Errors certain types of errors

Airbrake ignores the following exceptions by default

# Ignore Defaults 
AbstractController::ActionNotFound
ActiveRecord::RecordNotFound
ActionController::RoutingError
ActionController::InvalidAuthenticityToken
ActionController::UnknownAction
ActionController::UnknownHttpMethod
CGI::Session::CookieStore::TamperedWithCookie
Mongoid::Errors::DocumentNotFound
ActionController::UnknownFormat

Add an error to the Ignore Defaults

config.ignore << "ActiveRecord::IgnoreThisError"

Ignore only this error & forget the ignore defaults

config.ignore_only  = ["ActiveRecord::IgnoreThisError"]

Send Every Error / don't ignore anything

config.ignore_only  = []

Ignore user agents

# string version
config.ignore_user_agent << 'IgnoredUserAgent'

# regex version
config.ignore_user_agent  << /IgnoredUserAgent/

Ignore exceptions based on conditions

config.ignore_by_filter do |exception_data|
  true if exception_data[:error_class] == "RuntimeError"
end

Filter Parameters

sensitive values will be replaced with [FILTERED]

config.params_filters << "credit_card_number"

This will show up in the airbrake ui as:

credit_card_number: [FILTERED]

Here are the defaults:

# this example taken from the rails console of a test project
airbrake_test >>  Airbrake.configuration.params_filters
=> [
  [0] "password",
  [1] "password_confirmation"
]

Note: when rescuing exceptions within an ActionController method airbrake will reuse filters specified by #filter_parameter_logging.**

Something went wrong with that request. Please try again.