-
Notifications
You must be signed in to change notification settings - Fork 0
Filtering data before it's sent to Airbrake
You can specify a whitelist of errors that Airbrake will not report on. Use this feature when you are so apathetic to certain errors that you don't want them even logged.
This filter will only be applied to automatic notifications, not manual notifications (when #notify is called directly).
Airbrake ignores the following exceptions by default:
ActiveRecord::RecordNotFound
ActionController::RoutingError
ActionController::InvalidAuthenticityToken
CGI::Session::CookieStore::TamperedWithCookie
ActionController::UnknownAction
AbstractController::ActionNotFound
Mongoid::Errors::DocumentNotFound
To ignore errors in addition to those, specify their names in your Airbrake configuration block.
Airbrake.configure do |config|
config.api_key = '1234567890abcdef'
config.ignore << "ActiveRecord::IgnoreThisError"
end
To ignore only certain errors (and override the defaults), use the #ignore_only attribute.
Airbrake.configure do |config|
config.api_key = '1234567890abcdef'
config.ignore_only = ["ActiveRecord::IgnoreThisError"] # or [] to ignore no exceptions.
end
To ignore certain user agents, add in the #ignore_user_agent attribute as a string or regexp:
Airbrake.configure do |config|
config.api_key = '1234567890abcdef'
config.ignore_user_agent << /Ignored/
config.ignore_user_agent << 'IgnoredUserAgent'
end
To ignore exceptions based on other conditions, use #ignore_by_filter:
Airbrake.configure do |config|
config.api_key = '1234567890abcdef'
config.ignore_by_filter do |exception_data|
true if exception_data[:error_class] == "RuntimeError"
end
end
To replace sensitive information sent to the Airbrake service with [FILTERED] use #params_filters:
Airbrake.configure do |config|
config.api_key = '1234567890abcdef'
config.params_filters << "credit_card_number"
end
Note that, when rescuing exceptions within an ActionController method, airbrake will reuse filters specified by #filter_parameter_logging.