Sha256: 24f54b1b1afdac8487e0d59e62b881abd02dc9df5f1962a513e777a10bc2ded6
Contents?: true
Size: 1.37 KB
Versions: 1
Compression:
Stored size: 1.37 KB
Contents
# encoding: utf-8 require "logstash/inputs/base" require "logstash/namespace" require "socket" # Read events over the websocket protocol. class LogStash::Inputs::Websocket < LogStash::Inputs::Base config_name "websocket" milestone 1 default :codec, "json" # The url to connect to or serve from config :url, :validate => :string, :default => "0.0.0.0" # Operate as a client or a server. # # Client mode causes this plugin to connect as a websocket client # to the URL given. It expects to receive events as websocket messages. # # (NOT IMPLEMENTED YET) Server mode causes this plugin to listen on # the given URL for websocket clients. It expects to receive events # as websocket messages from these clients. config :mode, :validate => [ "server", "client" ], :default => "client" def register require "ftw" end # def register public def run(output_queue) # TODO(sissel): Implement server mode. 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 # def run end # class LogStash::Inputs::Websocket
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
logstash-lib-1.3.2 | lib/logstash/inputs/websocket.rb |