Class: LogStash::Inputs::Example
- Inherits:
-
Base
- Object
- Base
- LogStash::Inputs::Example
- Defined in:
- lib/logstash/inputs/example.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
26 27 28 |
# File 'lib/logstash/inputs/example.rb', line 26 def register @host = Socket.gethostname end |
#run(queue) ⇒ Object
def register
30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/logstash/inputs/example.rb', line 30 def run(queue) # This plugin uses Stud.interval. Because we want it to be able to stop # cleanly, we need to keep access to the current thread. It is referenced # in the stop method below. # # Other plugins may require similar access to the current thread. @thread = Thread.current Stud.interval(@interval) do event = LogStash::Event.new("message" => @message, "host" => @host) decorate(event) queue << event end # loop end |
#stop ⇒ Object
def run
45 46 47 |
# File 'lib/logstash/inputs/example.rb', line 45 def stop Stud.stop!(@thread) end |