Sha256: bcb385a83e71e7505730a5d49fd5aca04390c45f41d083e6e3dbd1f4baceae7c
Contents?: true
Size: 994 Bytes
Versions: 2
Compression:
Stored size: 994 Bytes
Contents
# encoding: utf-8 require "logstash/inputs/base" require "logstash/namespace" require "stud/interval" require "socket" # for Socket.gethostname # Generate a repeating message. # # This plugin is intented only as an example. class LogStash::Inputs::Example < LogStash::Inputs::Base config_name "example" # If undefined, Logstash will complain, even if codec is unused. default :codec, "plain" # The message string to use in the event. config :message, :validate => :string, :default => "Hello World!" # Set how frequently messages should be sent. # # The default, `1`, means send a message every second. config :interval, :validate => :number, :default => 1 public def register @host = Socket.gethostname end # def register def run(queue) Stud.interval(@interval) do event = LogStash::Event.new("message" => @message, "host" => @host) decorate(event) queue << event end # loop end # def run end # class LogStash::Inputs::Example
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
logstash-input-example-0.1.2 | lib/logstash/inputs/example.rb |
logstash-input-example-0.1.1 | lib/logstash/inputs/example.rb |