DockerFluentLogger
@TODO
Installation
Add this line to your application's Gemfile:
gem 'docker-fluent-logger'
And then execute:
$ bundle
Or install it yourself as:
$ gem install docker-fluent-logger
Setup
Execute following command in root directory of application.
$ bundle exec docker-fluent-logger install
create config/initializers/lograge.rb
Add following code to app/controller/application_controller.rb
.
def append_info_to_payload(payload)
super
payload[:uuid] = request.uuid
payload[:url] = request.url
payload[:referer] = request.referer
payload[:remote_ip] = request.remote_ip
payload[:user_agent] = request.user_agent
end
Add following code to config/environments/***.rb
.
if ENV['RAILS_LOG_TO_STDOUT'].present?
logger = LogStashLogger.new(type: :stdout)
logger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(logger)
end
Enable RAILS_LOG_TO_STDOUT
in config/deploy/***.yml
.
environment:
- name: RAILS_LOG_TO_STDOUT
value: enabled
License
MIT