Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 37 additions & 1 deletion lib/logstash/inputs/s3.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ class LogStash::Inputs::S3 < LogStash::Inputs::Base
include LogStash::PluginMixins::AwsConfig::V2

config_name "s3"



default :codec, "plain"

Expand Down Expand Up @@ -68,6 +70,15 @@ class LogStash::Inputs::S3 < LogStash::Inputs::Base
# default to the current OS temporary directory in linux /tmp/logstash
config :temporary_directory, :validate => :string, :default => File.join(Dir.tmpdir, "logstash")

# Specify a custom endpoint for use with non-AWS S3 implementations, e.g.,
# Ceph. Provide a URL in the format http://127.0.0.1:8080/
config :endpoint, :validate => :string
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be available through the mixin all the aws like plugins use

So no need to implement it here.

Only the force_path_style setting below is s3 specific, can you respin this PR to only add that setting?


# When false, specify the bucket in the subdomain. When true, specify the bucket in the path.
config :force_path_style, :validate => :boolean, :default => false



public
def register
require "fileutils"
Expand All @@ -76,6 +87,7 @@ def register

@logger.info("Registering s3 input", :bucket => @bucket, :region => @region)


s3 = get_s3object

@s3bucket = s3.bucket(@bucket)
Expand Down Expand Up @@ -386,8 +398,32 @@ def delete_file_from_bucket(object)

private
def get_s3object
s3 = Aws::S3::Resource.new(aws_options_hash)
s3 = Aws::S3::Resource.new(full_options)
end


def full_options
options = Hash.new
options.merge(aws_options_hash)
.merge(endpoint_options)
end

def endpoint_options
if @endpoint
uri = URI(@endpoint)
{
:endpoint => @endpoint,
:force_path_style => @force_path_style,
}
else
{}
end
end

def bucket_resource
Aws::S3::Bucket.new(@bucket, full_options)
end


private
module SinceDB
Expand Down