Sha256: edaefb28a0df75992d74e01d75e65980f4de528deab36d61ce8a184556e146ad
Contents?: true
Size: 946 Bytes
Versions: 9
Compression:
Stored size: 946 Bytes
Contents
require "eventmachine-tail" require "logstash/inputs/base" require "logstash/namespace" require "socket" # for Socket.gethostname class LogStash::Inputs::Stdin < LogStash::Inputs::Base public def register EventMachine::attach($stdin, InputHandler, self) @url.host = Socket.gethostname end # def register public def receive(event) event = LogStash::Event.new({ "@message" => event, "@type" => @type, "@tags" => @tags.clone, }) event.source = @url @logger.debug(["Got event", event]) @callback.call(event) end # def receive class InputHandler < EventMachine::Connection def initialize(obj) @receiver = obj end # def initialize def receive_data(data) @buffer ||= BufferedTokenizer.new @buffer.extract(data).each do |line| @receiver.receive(line) end end # def receive_data end # class InputHandler end # class LogStash::Inputs::Stdin
Version data entries
9 entries across 9 versions & 1 rubygems