Skip to content

Instantly share code, notes, and snippets.

@obahareth
Forked from czj/Gemfile
Created August 28, 2022 09:06
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save obahareth/81a0ebed8658cc5593c1269a1ead3f27 to your computer and use it in GitHub Desktop.
Outputting Rails app logs to Logz.io via logstash
gem "lograge"
gem "logstash-event"
gem "logstash-logger"
LogStashLogger.configure do |config|
config.customize_event do |event|
event["token"] = "1e23az12e12eza12aze13aez13aez13aez12zae12e123"
end
end
# config/initializers/lograge.rb
# OR
# config/environments/production.rb
Rails.application.configure do
config.lograge.enabled = true
config.lograge.formatter = Lograge::Formatters::Logstash.new
config.lograge.logger = LogStashLogger.new(type: :tcp, host: "listener.logz.io", port: 5050)
# Optionnal
# config.lograge.keep_original_rails_log = true
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment