lib/logstash/codecs/google_appengine.rb in logstash-codec-google_appengine-1.2.0 vs lib/logstash/codecs/google_appengine.rb in logstash-codec-google_appengine-1.3.0
- old
+ new
@@ -20,25 +20,28 @@
end
flatten(json).each { |flattenedJson|
yield LogStash::Event.new(flattenedJson)
}
end
- rescue => e
- @logger.info("Failed to process data", :error => e, :data => data)
- yield LogStash::Event.new("message" => data, "tags" => ["_googleappengineparsefailure"])
+ rescue => e
+ @logger.info("Failed to process data", :error => e, :data => data)
+ yield LogStash::Event.new("message" => data, "tags" => ["_googleappengineparsefailure"])
end
end
end
-
private
def is_parse_failure(event)
event["tags"] && event["tags"].include?("_jsonparsefailure")
end
def flatten(event)
payload = event['protoPayload']
lines = payload['line']
- payload.delete('line')
- lines.map { |line| payload.merge(line) }
+ if lines
+ payload.delete('line')
+ lines.map { |line| payload.merge(line) }
+ else
+ [payload]
+ end
end