Configuration options

Customize the content of error reports and how reports are delivered to Bugsnag.

Bugsnag can be configured using the configure block:

Bugsnag.configure do |config|
  config.api_key = 'your-api-key-here'

The configuration for Bugsnag can also be changed by accessing the configuration directly:

Bugsnag.configuration.api_key = 'your-api-key-here'

Configuration options


Add callbacks to modify or discard error events before they are sent to Bugsnag — see Customizing Error Reports for more information.

callback = proc |report| do
  report.user = {



Your Integration API Key (required).

config.api_key = 'your-api-key-here'

You can find your API key in Project Settings.


You can set the type of application executing the current code by using app_type:

config.app_type = 'resque'

This is usually used to represent if you are running in a Rails server, Sidekiq job or Rake task for example. Bugsnag will automatically detect most application types for you.


If you want to track in which versions of your application each exception happens, you can set app_version. This is set to nil by default.

config.app_version = '2.5.1'


By default, we will automatically notify Bugsnag of any fatal exceptions in your application. If you want to stop this from happening, you can set auto_notify:

config.auto_notify = false


By default, Bugsnag will automatically capture and report session information from your application. Use this flag to disable all automatic reporting.

config.auto_capture_sessions = false


An array of callbacks to be run when a breadcrumb is left. Each callback will be passed a breadcrumb.

config.before_breadcrumb_callbacks << do |breadcrumb|
  breadcrumb.meta_data[:user] = get_current_user


Sets exception classes that will be discarded and not sent to Bugsnag.

config.discard_classes << "ActiveRecord::StatementInvalid"

You can also provide a regular expression to match multiple errors at once.

config.discard_classes << /^ActiveRecord::.*/

By default, the following classes will be discarded:


The default values are set by the ignore_classes option.


Determines how events and sessions are sent to Bugsnag. By default, Resque and Shoryuken applications will use the :synchronous method and other applications use :thread_queue.

config.delivery_method = :thread_queue

:thread_queue delivery relies on an at_exit hook to ensure error reports are delivered. In Resque applications, :thread_queue delivery will be used if the RUN_AT_EXIT_HOOKS environment variable is “1”.

See Resque issue #1664 for more information about at_exit hooks in Resque.

The delivery methods available by default are:

  • :synchronous — sends data immediately, blocking the current thread.
  • :thread_queue — adds data to a queue, which will be sent when the current thread exits.

Custom delivery methods can be implemented by creating a class that has a static deliver method, with this signature:

# @param url [String] The URL to send the data to.
# @param body [String] The serialised request data to send.
# @param configuration [Bugsnag::Configuration] A Bugsnag Configuration object.
# @param options [Hash] Holds the HTTP headers for the request under the ':headers' key.
def self.deliver(url, body, configuration, options={})

The new delivery method must be registered before it can be used:

Bugsnag::Delivery.register(:my_delivery_method, MyDeliveryMethodClass)


An array of types that can be automatically captured. Defaults to all breadcrumb types.

Setting this to an empty array will prevent automatic breadcrumb capture.

config.enabled_automatic_breadcrumb_types = [] # No breadcrumbs will automatically be captured

Valid breadcrumb types are:



By default we will send error reports to and sessions to

If you are using Bugsnag On-premise you’ll need to set these to your Event Server and Session Server endpoints. If the notify endpoint is set but the sessions endpoint is not, session tracking will be disabled automatically to avoid leaking session information outside of your server configuration, and a warning will be logged.

  "", # Your notify, "Event Server", endpoint
  "", # Your session, "Session Server", endpoint


The name or descriptor of the Ruby server host. Defaults to the server’s hostname.

config.hostname = "NameOfServer-1B"


Deprecated: Use discard_classes instead.

Sets for which exception classes we should not send exceptions to Bugsnag.

config.ignore_classes << ActiveRecord::StatementInvalid

You can also provide a lambda function here to ignore by other exception attributes or by a regex:

config.ignore_classes << lambda {|ex| ex.message =~ /timeout/}

By default, ignore_classes contains the following:



Sets which logger to use for Bugsnag log messages. In rails apps, this is automatically set to use Rails.logger, otherwise it will be set to


The number of breadcrumbs that can be captured before the oldest start to be dropped. Defaults to 25.

config.max_breadcrumbs = 10 # A maximum of 10 breadcrumbs will be kept at any one time


Sets which keys should be filtered out from the report and breadcrumb metadata before sending them to Bugsnag. Use this if you want to ensure you don’t send sensitive data such as passwords, and credit card numbers to our servers. You can add both strings and regular expressions to this array. When adding strings, keys which contain the string will be filtered. When adding regular expressions, any keys which match the regular expression will be filtered.

config.meta_data_filters += ['credit_card_number', /^password$/]

By default, meta_data_filters is set to


and for Rails apps, all values from Rails.configuration.filter_parameters are added as well. String values within Rails.configuration.filter_parameters are matched as case-sensitive substrings and regular expression values are imported as-is.

Note: Assigning (=) instead of appending (+=) to the default value will remove the default protections.


By default, we will notify Bugsnag of exceptions that happen in any release_stage. If you would like to change which release stages notify Bugsnag of exceptions you can set notify_release_stages:

config.notify_release_stages = ['production', 'development']


We mark stacktrace lines as inProject if they come from files inside your project_root. In rails apps this value is automatically set to RAILS_ROOT, otherwise you should set it manually:

config.project_root = '/var/www/myproject'

To prevent particular paths under your project root, such as third-party libraries, from being marked as inProject use the vendor_path configuration option.


Sets the address of the HTTP proxy that should be used for requests to Bugsnag.

config.proxy_host = ''

All proxy options can also be configured using the http_proxy or https_proxy environment variables as described in the Net::HTTP documentation:


Alternatively the proxy options can be parsed from a url by calling the parse_proxy method:



Sets the password for the user that should be used to send requests to the HTTP proxy for requests to bugsnag.

config.proxy_password = 'proxy_secret_password_here'


Sets the port of the HTTP proxy that should be used for requests to Bugsnag.

config.proxy_port = 1089


Sets the user that should be used to send requests to the HTTP proxy for requests to bugsnag.

config.proxy_user = 'proxy_user'


If you would like to distinguish between errors that happen in different stages of the application release process (development, production, etc) you can set the release_stage that is reported to Bugsnag.

config.release_stage = 'development'

In rails apps this value is automatically set from RAILS_ENV, and in rack apps it is automatically set to RACK_ENV. Otherwise the default is ‘production’.


Bugsnag can transmit your rack environment to help diagnose issues. This environment can sometimes contain private information so Bugsnag does not transmit by default. To send your rack environment, set the send_environment option to true.

config.send_environment = true


Bugsnag automatically sends a small snippet of the code that crashed to help you diagnose even faster from within your dashboard. If you don’t want to send this snippet you can set the send_code option to false.

config.send_code = false


By default the timeout for posting errors to Bugsnag is 15 seconds, to change this you can set the timeout:

config.timeout = 10


Sets the regular expression used to determine whether a stacktrace line is considered out of project.

config.vendor_path = %r{^(vendor\/|\.bundle\/|third_party\/)}

By default this includes vendor/ and .bundle/ but can be expanded to include further directories under the project root that you would like Bugsnag to consider “out of project” for grouping purposes.

Custom middleware loading

By default all Ruby framework integrations Bugsnag provides will be initialized when the notifier is loaded. This behaviour can be disabled by setting the environment variable BUGSNAG_DISABLE_AUTOCONFIGURE to true inside of your application. Integrations can then be required as necessary using: