Method: SplunkDataReader#read_from_splunk
- Defined in:
- lib/data_services/splunk_data_reader.rb
#read_from_splunk ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/data_services/splunk_data_reader.rb', line 46 def read_from_splunk job = @service.create_search("search index=figaro", :earliest_time => "-30d", :latest_time => "now") while !job.is_ready?() sleep(0.1) end while !job.is_done?() sleep(0.1) end stream = job.results(:count => 1, :offset => 0) # Or: stream = job.events(:count => 3, :offset => 0) results = Splunk::ResultsReader.new(stream) results.each do |result| puts result["_raw"] end end |