Skip to content

Instantly share code, notes, and snippets.

@teamon
Last active December 18, 2015 03:29
Show Gist options
  • Save teamon/5718267 to your computer and use it in GitHub Desktop.
Save teamon/5718267 to your computer and use it in GitHub Desktop.
logstash + rails + redis
# Gemfile
gem "logstasher"
# production.rb
config.logstasher.enabled = true
# config/initializers/logstash.rb
$logstasher_redis = Redis.new(:port => 9002)
module LogStasher
class RequestLogSubscriber < ActiveSupport::LogSubscriber
alias_method :orig_process_action, :process_action
def process_action(event)
orig_process_action(event)
$logstasher_redis.publish("logstash:channel", event.to_json)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment