Class: LogStash::Inputs::HTTP_Poller
- Inherits:
-
Base
- Object
- Base
- LogStash::Inputs::HTTP_Poller
- Includes:
- PluginMixins::HttpClient
- Defined in:
- lib/logstash/inputs/http_poller.rb
Constant Summary collapse
- Schedule_types =
%w(cron every at in)
Instance Method Summary collapse
Instance Method Details
#register ⇒ Object
46 47 48 49 50 51 52 |
# File 'lib/logstash/inputs/http_poller.rb', line 46 def register @host = Socket.gethostname.force_encoding(Encoding::UTF_8) @logger.info("Registering http_poller Input", :type => @type, :interval => @interval, :schedule => @schedule, :timeout => @timeout) setup_requests! end |
#run(queue) ⇒ Object
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/logstash/inputs/http_poller.rb', line 125 def run(queue) #interval or schedule must be provided. Must be exclusively either one. Not neither. Not both. raise LogStash::ConfigurationError, "Invalid config. Neither interval nor schedule was specified." \ unless @interval || @schedule raise LogStash::ConfigurationError, "Invalid config. Specify only interval or schedule. Not both." \ if @interval && @schedule if @interval setup_interval(queue) elsif @schedule setup_schedule(queue) else #should not reach here raise LogStash::ConfigurationError, "Invalid config. Neither interval nor schedule was specified." end end |
#stop ⇒ Object
54 55 56 57 |
# File 'lib/logstash/inputs/http_poller.rb', line 54 def stop Stud.stop!(@interval_thread) if @interval_thread @scheduler.stop if @scheduler end |