Class: LogStash::Codecs::GoogleAppengine

Inherits:
Base
  • Object
show all
Defined in:
lib/logstash/codecs/google_appengine.rb

Instance Method Summary collapse

Instance Method Details

#decode(data) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/logstash/codecs/google_appengine.rb', line 15

def decode(data)
  begin
    @json.decode(data) do |json|
      if is_parse_failure(json)
        return yield json
      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"])
  end
end

#registerObject



11
12
13
# File 'lib/logstash/codecs/google_appengine.rb', line 11

def register
  @json = LogStash::Codecs::JSON.new
end