ApplicasterLogger
Dispatches all Rails and DelayedJob log events to logstash
Combines Lograge with logstash-logger
Installation
Add this line to your application's Gemfile:
gem 'applicaster-logger'
And then execute:
$ bundle
Usage
- Enable it for the relevant environments, e.g. production:
# config/environments/production.rb
MyApp::Application.configure do
config.applicaster_logger.enabled = true
end
defaults to: ENV["LOGSTASH_URI"].present?
- Configuring logstash output:
# config/environments/production.rb
MyApp::Application.configure do
config.applicaster_logger.logstash_config = { type: :redis }
end
defaults to: { uri: ENV["LOGSTASH_URI"] }
if LOGSTASH_URI
is set or { type: :stdout }
otherwise
For available options see: https://github.com/dwbutler/logstash-logger#basic-usage
- To set the application name:
# config/environments/production.rb
MyApp::Application.configure do
config.applicaster_logger.application_name = "my_best_app"
end
defaults to: Rails.application.class.parent.to_s.underscore
- To separately control the Sidekiq logging level:
# config/environments/production.rb
MyApp::Application.configure do
config.applicaster_logger.sidekiq_log_level = Logger::ERROR # Logger::DEBUG etc..
end
defaults to applicaster_logger.level
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request