Class: Fluent::Plugin::Base64Parser

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

Instance Method Summary collapse

Constructor Details

#initializeBase64Parser

Returns a new instance of Base64Parser.



11
12
13
14
# File 'lib/fluent/plugin/parser_base64.rb', line 11

def initialize
  super
  require 'base64'
end

Instance Method Details

#parse(text) {|time, record| ... } ⇒ Object

Yields:

  • (time, record)


16
17
18
19
20
21
22
23
24
25
26
# File 'lib/fluent/plugin/parser_base64.rb', line 16

def parse(text)
  record = {}
  if (@base64_encode)
    record[@message_key] = ::Base64.strict_encode64(text)
  else
    record[@message_key] = ::Base64.strict_decode64(text)
  end

  time = @estimate_current_event ? Fluent::Engine.now : nil
  yield time, record
end