Last active
December 18, 2015 03:29
-
-
Save teamon/5718267 to your computer and use it in GitHub Desktop.
logstash + rails + redis
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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