Class: LogStash::Outputs::Beanstalk
- Defined in:
- lib/logstash/outputs/beanstalk.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(url, config = {}, &block) ⇒ Beanstalk
constructor
A new instance of Beanstalk.
- #receive(event) ⇒ Object
- #register ⇒ Object
Constructor Details
#initialize(url, config = {}, &block) ⇒ Beanstalk
Returns a new instance of Beanstalk.
7 8 9 10 11 12 13 14 |
# File 'lib/logstash/outputs/beanstalk.rb', line 7 def initialize(url, config={}, &block) super @ttr = @urlopts["ttr"] || 300; if @url.path == "" or @url.path == "/" raise "must specify a tube for beanstalk output" end end |
Instance Method Details
#receive(event) ⇒ Object
26 27 28 |
# File 'lib/logstash/outputs/beanstalk.rb', line 26 def receive(event) @beanstalk.put(event.to_json, :ttr => @ttr) end |
#register ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/logstash/outputs/beanstalk.rb', line 17 def register tube = @url.path[1..-1] # Skip leading '/' port = @url.port || 11300 @beanstalk = EMJack::Connection.new(:host => @url.host, :port => port, :tube => tube) end |