We need to search for specific errors quiet often, this script helps us find them without having to go through the web interface.
Usage
auth_token can be found on your settings page, it is NOT the api-key.
ruby airbrake_search.rb your-account your-auth-token | grep foo
Code
#! /usr/bin/env ruby
# https://grosser.it/2012/09/08/airbrake-search
# search for errors given a name
#
# gem install airbrake-api
# USAGE: ruby airbrake_search.rb your-account your-auth-token | grep SOMETHING
# https://your-account.airbrake.io/errors/ID
require "airbrake-api"
AirbrakeAPI.account = ARGV[0] || raise("need airbrake account as ARGV[0]")
AirbrakeAPI.auth_token = ARGV[1] || raise("need airbrake token as ARGV[1], go to airbrake -> settings, copy your auth token")
AirbrakeAPI.secure = true
page = 1
while errors = AirbrakeAPI.errors(:page => page)
errors.each do |error|
puts "#{error.id} -- #{error.error_class} -- #{error.error_message} -- #{error.created_at}"
end
$stderr.puts "Page #{page} ----------\n"
page += 1
end