Class: LogStash::Inputs::Evvnt
- Inherits:
-
Base
- Object
- Base
- LogStash::Inputs::Evvnt
- Defined in:
- lib/logstash/inputs/evvnt.rb
Overview
Hits the challenge endpoint every interval seconds and sends the data upstream
Instance Method Summary collapse
- #register ⇒ Object
-
#run(queue) ⇒ Object
def register.
Instance Method Details
#register ⇒ Object
36 37 38 |
# File 'lib/logstash/inputs/evvnt.rb', line 36 def register @logger.info("Registering Evvnt Input", :host => @host, :path => @path, :interval => @interval) end |
#run(queue) ⇒ Object
def register
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/logstash/inputs/evvnt.rb', line 40 def run(queue) # start the interval job Stud.interval(@interval) do connection = Faraday.new(:url => @host, :ssl => { :ca_path => @capath }) do |conn| # middleware used to set the response content-type to json conn.response :json, :content_type => /\bjson$/ conn.adapter Faraday.default_adapter end # set the Authentication header connection.basic_auth(@user, @pass) # make the request response = connection.get(@path) # for each entry in the response enqueue a new event response.body.each { |e| event = LogStash::Event.new e decorate(event) queue << event } end # loop end |