Class: LogStash::Inputs::Websocket

Inherits:
Base
  • Object
show all
Defined in:
lib/logstash/inputs/websocket.rb

Overview

Read events over the websocket protocol.

Instance Method Summary collapse

Instance Method Details

#registerObject



21
22
23
# File 'lib/logstash/inputs/websocket.rb', line 21

def register
  require "ftw"
end

#run(output_queue) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/logstash/inputs/websocket.rb', line 26

def run(output_queue)
  agent = FTW::Agent.new
  begin
    websocket = agent.websocket!(@url)
    websocket.each do |payload|
      @codec.decode(payload) do |event|
        decorate(event)
        output_queue << event
      end
    end
  rescue => e
    @logger.warn("websocket input client threw exception, restarting",
                 :exception => e)
    sleep(1)
    retry
  end # begin
end