Class: LogStash::Inputs::Redis
- Defined in:
- lib/logstash/inputs/redis.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(url, config = {}, &block) ⇒ Redis
constructor
A new instance of Redis.
- #register ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(url, config = {}, &block) ⇒ Redis
Returns a new instance of Redis.
7 8 9 |
# File 'lib/logstash/inputs/redis.rb', line 7 def initialize(url, config={}, &block) super end |
Instance Method Details
#register ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/logstash/inputs/redis.rb', line 11 def register _, @db, @queue = @url.path.split('/') puts @url.host, @url.port, @db, @queue EM.run do redis = EM::Protocols::Redis.connect :host => @url.host, :port => @url.port, :db => @db pop = lambda do redis.blpop @queue, 0 do |response| event = LogStash::Event.new({ "@message" => response, "@type" => @type, "@tags" => @tags.clone, }) event.source = @url @callback.call(event) pop.call end end pop.call end end |