0.0
No commit activity in last 3 years
No release in over 3 years
Exception post to Elasticsearch.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 2.0.0, ~> 2.0
 Project Readme

ExesPoster

ExesPoster is an exception post tool to Elasticsearch.

Installation

Add this line to your application's Gemfile:

gem 'exes_poster'

And then execute:

$ bundle

Or install it yourself as:

$ gem install exes_poster

Getting Started

  1. To set an environment variable "ELASTICSEARCH_URL"
$ export ELASTICSEARCH_URL=localhost:9200
  1. Call ExesPoster.post_exception with caught exception in the rescue section.
require 'exes_poster'

begin
    raise RuntimeError, 'hoge'
rescue => e
    ExesPoster.post_exception(e)
end
  1. You can find exception information at your elasticsearch.
{
  "_index"   : "exes_index",
  "_type"    : "exception",
  "_id"      : "eIb4VGPbRB6tw0eGnUXUXA",
  "_version" : 1,
  "found"    : true,
  "_source"  : {
    "message"    : "hoge",
    "@timestamp" : "2016-09-21T16:28:09.753+09:00",
    "detail"     : {
      "class"     : "RuntimeError",
      "backtrace" : [
        "/PATH/TO/ERROR/FILE1.rb:123:in `block (3 levels) in <top (required)>'",
        "/PATH/TO/ERROR/FILE2.rb:456:in `block (2 levels) in function'",
        "/PATH/TO/ERROR/FILE3.rb:15:in `<main>'"
      ]
    }
  }
}

in Japanese

Configuration

You can set Elasticsearch url and index name.

ExesPoster.setup do |config|
  config.es_url   = 'example.com:9200'
  config.es_index = 'hoge_test'
end

Test

  1. You set an environment variable DOCKER_HOST or ELASTICSEARCH_URL
$ export ELASTICSEARCH_URL=localhost:9200

or

$ eval $(docker-machine env default)
  1. Then exec rake
$ bundle exec rake