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



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

def decode(data)
  begin
    @json.decode(data) do |json|
      if is_parse_failure(json)
        return @logger.error("Failed to process data", :data => json)
      end

      flatten(json).each { |flattenedJson|
        yield LogStash::Event.new(flattenedJson)
      }
    end
  rescue => e
    @logger.error("Failed to process data", :error => e, :data => data)
  end
end

#registerObject



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

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