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

- old
+ new

@@ -15,11 +15,11 @@ def decode(data) begin data = LogStash::Json.load(data) flatten(data).each { |flattenedJson| - yield LogStash::Event.new flattenedJson + yield(LogStash::Event.new(flattenedJson)) } rescue => e @logger.error "Failed to process data", :error => e, :data => data end end @@ -31,16 +31,12 @@ event["tags"] && event["tags"].include?("_jsonparsefailure") end def flatten(event) payload = event['protoPayload'] - lines = payload['line'] - payload.delete '@type' - - + lines = payload.delete 'line' if lines - payload.delete 'line' lines.map.with_index { |line, i| merged = payload.merge line merged['_id'] = @md5.hexdigest merged['requestId'] + i.to_s merged['message'] = merged.delete 'logMessage' merged