Class: Fluent::Plugin::LambdaOutput

Inherits:
Output
  • Object
show all
Defined in:
lib/fluent/plugin/out_lambda.rb

Constant Summary collapse

DEFAULT_BUFFER_TYPE =
"memory"

Instance Method Summary collapse

Constructor Details

#initializeLambdaOutput

Returns a new instance of LambdaOutput.



29
30
31
# File 'lib/fluent/plugin/out_lambda.rb', line 29

def initialize
  super
end

Instance Method Details

#configure(conf) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/fluent/plugin/out_lambda.rb', line 33

def configure(conf)
  compat_parameters_convert(conf, :buffer, :inject)
  super

  aws_opts = {}

  if @profile
    credentials_opts = {:profile_name => @profile}
    credentials_opts[:path] = @credentials_path if @credentials_path
    credentials = Aws::SharedCredentials.new(credentials_opts)
    aws_opts[:credentials] = credentials
  end

  if @group_events
    raise Fluent::ConfigError, "could not group events without 'function_name'" if @function_name.nil?
  end

  aws_opts[:access_key_id] = @aws_key_id if @aws_key_id
  aws_opts[:secret_access_key] = @aws_sec_key if @aws_sec_key
  aws_opts[:region] = @region if @region
  aws_opts[:endpoint] = @endpoint if @endpoint

  configure_aws(aws_opts)
end

#format(tag, time, record) ⇒ Object



68
69
70
# File 'lib/fluent/plugin/out_lambda.rb', line 68

def format(tag, time, record)
  [tag, time, record].to_msgpack
end

#formatted_to_msgpack_binaryObject



64
65
66
# File 'lib/fluent/plugin/out_lambda.rb', line 64

def formatted_to_msgpack_binary
  true
end

#startObject



58
59
60
61
62
# File 'lib/fluent/plugin/out_lambda.rb', line 58

def start
  super

  @client = create_client
end

#write(chunk) ⇒ Object



72
73
74
75
76
77
78
79
# File 'lib/fluent/plugin/out_lambda.rb', line 72

def write(chunk)
  chunk = chunk.to_enum(:msgpack_each)
  if @group_events
    write_batch(chunk)
  else
    write_by_one(chunk)
  end
end