As you rescue errors in your application you can send them to an ElasticSearch index to be used later for analytics, reports and dashboards.
Alternatively, ElasticNotifier is also compatible with exception_notification gem as a Notifier plug-in. ExceptionNotification is a Rack middleware that intercepts any unhandled errors from Rails (Sinatra or any other Rack-based) applications and sends notifications using various configurable notifiers.
Add the gem to your application’s
Gemfile and run
Configure the notifier:
For Rails applications you can add the code above to
config/initializers/elastic_notifier.rb so it will be available throughout the app.
Then send error notifications as you rescue errors:
How can I use it with ExceptionNotification gem?
config/initializers/elastic_notifier.rb, after initializing the notifier object as described above, you need to register it as documented here:
Now any unhandled failures from your app will result in a document sent to ElasticSearch.
For background processes, you can leverage all registered notifiers (email, Elastic Search, Slack, etc.) with a single command!
What information is being sent?
At the time the notifier is invoked it collects some information from the environment, serializes it together with the exception details and sends it to the Elastic instance.
It is possible to override parameters such as
program_name which will remain static for the notifier instance.
Do you fancy contributing?
Originally published at hspazio.github.io