class Object
Constants
- DEFAULT_FIELDS
you can get the list of fields in the documentation provided by Cloudflare
Public Instance Methods
parse_content(content)
click to toggle source
# File lib/logstash/inputs/cloudflare.rb, line 36 def parse_content(content) return [] if content.empty? lines = [] content.split("\n").each do |line| line = line.strip next if line.empty? begin lines << JSON.parse(line) rescue JSON::ParserError @logger.error("Couldn't parse JSON out of '#{line}'") next end end lines end
response_body(response)
click to toggle source
# File lib/logstash/inputs/cloudflare.rb, line 28 def response_body(response) return '' unless response.body return response.body.strip unless response.header['Content-Encoding'].eql?('gzip') sio = StringIO.new(response.body) gz = Zlib::GzipReader.new(sio) gz.read.strip end