Configuration Reference

Configuration options for rollbar-gem


# Set the access token, branch, code version, and project gems
Rollbar.configure do |config |
  config.access_token = '...'
  config.branch = 'master'
  config.code_version = '3da541559918a808c2402bba5012f6c60b27661c'
  config.project_gems = ['my_custom_gem', 'my_other_gem']

# Set an async_handler
config.use_async = true
config.async_handler = { |payload| { Rollbar.process_from_async_handler(payload) }

You can configure the SDK to trigger your additional custom logic in selected situations through the Rollbar::Configuration.hook method.

Rollbar.configure do |config|
  config.hook :on_error_response do |response|

Triggered when Rollbar API responds with any status code different than 200. Parameters: response.

Triggered when the SDK throws an internal unexpected error. Parameters: exception.

Configuration Reference


Sets the access token used to send payloads to Rollbar.

Items sent through a given access token arrive in that access token's project and respect the rate limits set on that access token.


If config.use_async = true explicitly sets the function used to send asynchronous payloads to Rollbar. Should be an object that responds to #call. Not needed if using one of the built in async reporters:

  • girl_friday
  • sucker_punch
  • Sidekiq
  • Resque
  • threading


If async_json_payload = true it allows truncation to happen before the payload is added to queues, ensuring the payload is always under 500K bytes. This flag applies to any/all of the async handlers (Sidekiq, Resque, ActiveJob, AsyncJob, etc.)

Default: false


Handler to be called before sending via an async handler. The handler should be a Proc object or object responding to #call method.

The received argument is the current job being processed.

The handler should return true to skip the report, or a falsey value to send.

Default: nil


Set with any instance of ActiveSupport::BacktraceCleaner or with any object that supports its interface. When set, it will be applied to all error stacks before sending to Rollbar.

Default: nil


Handlers to be called before processing data sent. The handlers should be Proc objects or objects responding to #call method.

The received argument is a Hash object with these keys:

  • level: the level used for the report.
  • exception: the exception that caused the report, if any.
  • message: the message to use for the report, if any.
  • extra: extra data passed to the report methods.
  • scope: the current Scope; see Scope

It supports ignoring items


The name of the branch of the code that is running. Used for linking filenames in stacktraces to GitHub.

Default: "master"


Report uncaught exceptions to Rollbar. Set to false to ignore uncaught exceptions.

Default: true


A string up to 40 characters describing the version control number (i.e. git SHA) of the current revision. Used for linking filenames in stacktraces to GitHub.

Rollbar understands these formats:

  • semantic version (i.e. "2.1.12")
  • integer (i.e. "45")
  • git SHA (i.e. "3da5415...")


The method to call to gather custom data to send with each rollbar request.

def custom_data
  return {
    :custom => {
      :key1 => get_key_one,
      :key2 => get_key_two
    :server => {
      :root => '/home/username/www/'


What logger to use for printing debugging and informational messages during operation.

Default: or ::Rails.logger when using Rails


Disables Rollbar's monkey patches in the Ruby core. One mandatory monkey patch is left. Be careful using this option as it may cause unexpected behavior in some situations.

Default: false


Disables monkey patching all non-core monkey patches and automatic reporting.

If you set this to true you will be responsible for rescuing and reporting all errors manually.

Default: false


Disables monkey patches on Rack classes, Rack::Builder.

Default: false


Set to false if you have delayed_job but do not wish to wrap jobs with a Rollbar notifier.

Default: true


The number of job failures before reporting the failure to Rollbar.

Default: 0 (Report any errors)


If set to false, no data will be sent to Rollbar.

Default: true


The environment that your code is running in.

Default: unspecified


An array of backup handlers if the async handlers fails. Each should respond to #call and should receive a payload.


For use with write_to_file. Indicates location of the Rollbar log file being tracked by rollbar-agent.


Indicates which framework you're using. Common options include 'Rails', 'Sinatra', and 'Rack' to name a few.

Default: 'Plain'


The hostname (reported to Rollbar as When nil, the value of Socket.gethostname will be used.

Default: nil


Specify error class names to ignore for internal errors from rollbar-gem. This shouldn't need to be updated unless there is an excess of unwanted internal error reports. Set true to ignore all internal errors.

Default: ['Net::ReadTimeout', 'Net::OpenTimeout', 'SocketError']


Ids of people whose reports you wish to ignore. Only works in conjunction with a properly defined person_method or person_id_method.

Default: []


Enable capture of local variables in error stack traces. Enable by setting config.locals = { :enabled => true }. More information

Default: disabled


When true, payloads will be logged to the configured local logger.

Default: false


The logger to use instead of the default logger. Especially useful when you wish to send log messages elsewhere.


Minimum level of logger messages to write to the log. Accepts 'debug', 'info', 'warn' or 'error'.

Default: 'info'


Sets the number of retries caused by timeouts on the POST request.

Default: 3


Default: 3


Extra data to send with the payload.


If not using Rails:

Populate the rollbar.person_data key with a hash containing :id, and optionally :username and :email.

Rails only: A string or symbol giving the name of the method on the controller. Should return an object with an id method, and optionally username and email methods. The names of the id, username and email methods can be overridden. See person_id_method, person_username_method, and person_email_method.


A string or symbol giving the name of the method on the user instance that returns the person's email. Gets called on the result of person_method. Ignored if person_method not present.


A string or symbol giving the name of the method on the user instance that returns the person's id. Gets called on the result of person_method. Ignored if person_method not present.


A string or symbol giving the name of the method on the user instance that returns the person's username. Gets called on the result of person_method. Ignored if person_method not present.


Raising an exception in Ruby is what populates the backtraces. If you report a manually initialized exception instead of a raised and rescued exception, the backtraces will be empty. Set populate_empty_backtraces to true to have Rollbar load the traces before sending them.


In the Rollbar interface, stacktraces are shown with in-project code expanded and other code collapsed. Stack frames are counted as in-project if they occur in a file that is inside of the configuration.root (automatically set to Rails.root if you're using Rails). The collapsed sections can be expanded by clicking on them.

If you want code from some specific gems to start expanded as well, you can configure this in config/initializers/rollbar.rb:

Rollbar.configure do |config |
  config.access_token = '...'
  config.project_gems =  ['my_custom_gem', 'my_other_gem']


When true, exceptions logged via the Rollbar logging methods will raise after reporting to Rollbar.

Default: false


When true, randomizes the number of asterisks used to display scrubbed fields.

Default: true


Set to false to skip automatic bundling of job metadata like queue, job class name, and job options.

Default: true


Set the request timeout for sending POST data to Rollbar.

Default: 3


Sets the server root. All stack frames outside that root are considered 'non-project' frames. Also used to setup GitHub linking.


When true, evaluates custom_data_method and returns {} if an error, otherwise reports the error to Rollbar.

Default: false


Fields to scrub out of the parsed request data. Will scrub from GET, POST, url, and several other locations. Does not recurse into the full payload. If a request contains one of these fields, the value will be replaced with a "*" before being sent.

Default: [:passwd, :password, :password_confirmation, :secret, :confirm_password, :secret_token]


The headers to scrub. The value will be replaced with a "*" before being sent

Default: ["Authentication"]


Set to false to skip scrubbing the password out of the URL. The value will be replaced with a "*" before being sent.

Default: true


Set to false to skip scrubbing the user out of the URL. The value will be replaced with a "*" before being sent.

Default: true


An array of fields to not scrub, even if they also appear in scrub_fields.

Default: []


The number of job re-tries before reporting an error to Rollbar via Sidekiq. Ignored unless you've called use_sidekiq.

Default: 0


When false items will be fully processed but not sent to Rollbar.

Default: true


When true, indicates you wish to send data to Rollbar asynchronously. If installed, uses girl_friday, otherwise defaults to Thread.

Default: false


Invoking this method will instruct the SDK to use your Rails' configured ActiveJob implementation to deliver items to Rollbar. This will automatically set use_async to true and async_handler to Rollbar::Delay::ActiveJob. Only available on Rails 4.2+.


When true, indicates you wish to send data to Rollbar with eventmachine. Won't work unless eventmachine is installed.

Default: false


When enabled, sends Rollbar data on a separate Ruby thread. use_thread can either take no arguments, or can take a thread priority:
config.use_thread({ :priority => 2 })

Default: false


When true, the gem will use the exception_level_filters when reporting. It can be overriden via the :use_exception_level_filters option. See Exception level filters


A string used to hash IP addresses when obfuscating them.


Specifies the rack env key that provides the user IP address. For example, this may be set to the key used by Cloudflare ('HTTP_CF_CONNECTING_IP') or any other custom key that contains the IP address.


Use this field to select a different level for uncaught errors (like critical, or warning).

Default: error


By default, the gem uses OpenSSL::SSL::VERIFY_PEER for SSL. Although it isn't recommended to change it, you can disable peer verification in case you experience SSL connection problems.

Default: true


The root of the web app that serves your Rollbar data. Unless you're an Enterprise customer running Rollbar on-premise, this should never change.

Default: ''


If true writes all errors to a log file which can be sent with rollbar-agent.

Default: false


For more information on rollbar-gem, please see the docs here.

Did this page help you?