Skip to content

EsLogger is a gem to intercept and save request in Elasticsearch

Notifications You must be signed in to change notification settings

Beetrack/es_logger

Repository files navigation

EsLogger

Maintainability

EsLogger is a gem to intercept and save request in Elasticsearch. It has support to:

  • Middleware to intercept and save request in Elasticsearch.
  • Generate initialize configuration.
  • Include pattern to accept the requests, Example: ^api\/external\/\w+ -> api/external/<some word>
  • Process asyncronous with Sidekiq.
  • Decode JWT Token and include headers to index.

Future

  • Generate new configuration to save custom objects.

Installation

Add this line to your application's Gemfile:

gem 'es_logger'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install es_logger

Usage

Generate initialize configuration:

rails generate es_logger:initialize

Include middleware in config/application.rb or config/environments/<environment>rb:

config.middleware.use EsLogger::Rack

Asyncronous Process

if Sidekiq is enabled without queue, it will use es_logger queue, remember that this should be created in sidekiq configuration.

Development

After checking out the repo, run bin/setup to install dependencies. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/Beetrack/es_logger.