Class: Fluent::CloudwatchLogsInput

Inherits:
Input
  • Object
show all
Includes:
Mixin::ConfigPlaceholders
Defined in:
lib/fluent/plugin/in_cloudwatch_logs.rb

Instance Method Summary collapse

Constructor Details

#initializeCloudwatchLogsInput

Returns a new instance of CloudwatchLogsInput.



31
32
33
34
35
# File 'lib/fluent/plugin/in_cloudwatch_logs.rb', line 31

def initialize
  super

  require 'aws-sdk-cloudwatchlogs'
end

Instance Method Details

#configure(conf) ⇒ Object



41
42
43
44
# File 'lib/fluent/plugin/in_cloudwatch_logs.rb', line 41

def configure(conf)
  super
  configure_parser(conf)
end

#placeholdersObject



37
38
39
# File 'lib/fluent/plugin/in_cloudwatch_logs.rb', line 37

def placeholders
  [:percent]
end

#shutdownObject



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

def shutdown
  @finished = true
  @thread.join
end

#startObject



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/fluent/plugin/in_cloudwatch_logs.rb', line 46

def start
  options = {}
  options[:region] = @region if @region
  options[:http_proxy] = @http_proxy if @http_proxy

  if @aws_use_sts
    Aws.config[:region] = options[:region]
    options[:credentials] = Aws::AssumeRoleCredentials.new(
      role_arn: @aws_sts_role_arn,
      role_session_name: @aws_sts_session_name
    )
  else
    options[:credentials] = Aws::Credentials.new(@aws_key_id, @aws_sec_key) if @aws_key_id && @aws_sec_key
  end

  @logs = Aws::CloudWatchLogs::Client.new(options)

  @finished = false
  @thread = Thread.new(&method(:run))
end