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
61
62
63
64
|
# File 'lib/fluent/plugin/out_aws-elasticsearch-service.rb', line 36
def get_connection_options(con_host=nil)
raise "`endpoint` require." if @endpoint.empty?
@endpoint.map do |ep|
raise Fluent::ConfigError, "Ensure you don't have a trailing slash on the endpoint URL in your fluentd configuration." if ep[:url].end_with?("/")
end
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
|