Class: Fluent::TextParser::SentryHttpParser

Inherits:
Parser
  • Object
show all
Defined in:
lib/fluent/plugin/parser_sentry_http.rb

Instance Method Summary collapse

Constructor Details

#initializeSentryHttpParser

Returns a new instance of SentryHttpParser.



13
14
15
# File 'lib/fluent/plugin/parser_sentry_http.rb', line 13

def initialize
  super
end

Instance Method Details

#configure(conf) ⇒ Object



17
18
19
# File 'lib/fluent/plugin/parser_sentry_http.rb', line 17

def configure(conf)
  super
end

#parse(text) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/fluent/plugin/parser_sentry_http.rb', line 21

def parse(text)
  message = Zlib::Inflate.inflate(Base64.decode64(text))
  record = Oj.load(message, :mode => :compat)

  record_time = record['timestamp']
  time = record_time.nil? ? Engine.now : Time.parse(record_time).to_i

  record = {@field_name => message} unless @json_parse

  yield time, record
rescue => e
  $log.warn "parse error: #{e.message}"
  yield nil, nil
end