Sha256: 56e1a2c58ef5f81a615539cf60cc695f0589d37df76cb287c7cdc6c4478719f8

Contents?: true

Size: 743 Bytes

Versions: 10

Compression:

Stored size: 743 Bytes

Contents

# encoding: utf-8
require "logstash/outputs/base"
require "logstash/namespace"
require "socket"

# Send events over UDP
#
# Keep in mind that UDP will lose messages.
class LogStash::Outputs::UDP < LogStash::Outputs::Base
  config_name "udp"
  
  default :codec, "json"

  # The address to send messages to
  config :host, :validate => :string, :required => true

  # The port to send messages on
  config :port, :validate => :number, :required => true

  public
  def register
    @socket = UDPSocket.new
    @codec.on_event do |event, payload|
      @socket.send(payload, 0, @host, @port)
    end
  end

  def receive(event)
    
    return if event == LogStash::SHUTDOWN
    @codec.encode(event)
  end

end # class LogStash::Outputs::Stdout

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
logstash-output-udp-3.0.6 lib/logstash/outputs/udp.rb
logstash-output-udp-3.0.5 lib/logstash/outputs/udp.rb
logstash-output-udp-3.0.4 lib/logstash/outputs/udp.rb
logstash-output-udp-3.0.3 lib/logstash/outputs/udp.rb
logstash-output-udp-3.0.2 lib/logstash/outputs/udp.rb
logstash-output-udp-3.0.1 lib/logstash/outputs/udp.rb
logstash-output-udp-3.0.0 lib/logstash/outputs/udp.rb
logstash-output-udp-2.0.4 lib/logstash/outputs/udp.rb
logstash-output-udp-2.0.2 lib/logstash/outputs/udp.rb
logstash-output-udp-2.0.1 lib/logstash/outputs/udp.rb