Class: Fluent::Plugin::AwsElasticsearchServiceOutput

Inherits:
ElasticsearchOutput show all
Defined in:
lib/fluent/plugin/out_aws-elasticsearch-service.rb

Instance Method Summary collapse

Instance Method Details

#get_connection_options(con_host = nil) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/fluent/plugin/out_aws-elasticsearch-service.rb', line 36

def get_connection_options(con_host=nil)
  raise "`endpoint` require." if @endpoint.empty?

  hosts =
    begin
      @endpoint.map do |ep|
        uri = URI(ep[:url])
        host = %w(user password path).inject(host: uri.host, port: uri.port, scheme: uri.scheme) do |hash, key|
          hash[key.to_sym] = uri.public_send(key) unless uri.public_send(key).nil? || uri.public_send(key) == ''
          hash
        end

        host[:aws_elasticsearch_service] = {
          :credentials => credentials(ep),
          :region => ep[:region]
        }

        host
      end
    end

  {
    hosts: hosts
  }
end

#write(chunk) ⇒ Object



62
63
64
# File 'lib/fluent/plugin/out_aws-elasticsearch-service.rb', line 62

def write(chunk)
  super
end