lib/logstash/codecs/google_appengine.rb in logstash-codec-google_appengine-1.12.0 vs lib/logstash/codecs/google_appengine.rb in logstash-codec-google_appengine-1.13.0

- old
+ new

@@ -1,31 +1,25 @@ # encoding: utf-8 require "logstash/codecs/base" require "logstash/namespace" -require "logstash/codecs/json" +require "logstash/json" require 'digest' class LogStash::Codecs::GoogleAppengine < LogStash::Codecs::Base config_name "google_appengine" public def register - @json = LogStash::Codecs::JSON.new @md5 = Digest::MD5.new end def decode(data) begin - @json.decode data do |json| - if is_parse_failure json - @logger.error("Failed to process data", :data => json) - else - flatten(json).each { |flattenedJson| - yield LogStash::Event.new flattenedJson - } - end - end + data = LogStash::Json.load(data) + flatten(data).each { |flattenedJson| + yield LogStash::Event.new flattenedJson + } rescue => e @logger.error "Failed to process data", :error => e, :data => data end end end