Class: LogStash::Inputs::InputYll
- Inherits:
-
Base
- Object
- Base
- LogStash::Inputs::InputYll
- Defined in:
- lib/logstash/inputs/input-yll.rb
Overview
Generate a repeating message.
This plugin is intented only as an example.
Instance Method Summary collapse
- #register ⇒ Object
-
#run(queue) ⇒ Object
def register.
-
#stop ⇒ Object
def run.
Instance Method Details
#register ⇒ Object
25 26 27 |
# File 'lib/logstash/inputs/input-yll.rb', line 25 def register @host = Socket.gethostname end |
#run(queue) ⇒ Object
def register
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/logstash/inputs/input-yll.rb', line 29 def run(queue) # we can abort the loop if stop? becomes true while !stop? event = LogStash::Event.new("message" => @message, "host" => @host) decorate(event) queue << event # because the sleep interval can be big, when shutdown happens # we want to be able to abort the sleep # Stud.stoppable_sleep will frequently evaluate the given block # and abort the sleep(@interval) if the return value is true Stud.stoppable_sleep(@interval) { stop? } end # loop end |
#stop ⇒ Object
def run
43 44 45 46 47 48 49 |
# File 'lib/logstash/inputs/input-yll.rb', line 43 def stop # nothing to do in this case so it is not necessary to define stop # examples of common "stop" tasks: # * close sockets (unblocking blocking reads/accepts) # * cleanup temporary files # * terminate spawned threads end |