-
Notifications
You must be signed in to change notification settings - Fork 151
Allow non-AWS endpoints #100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
## 4.0.14 | ||
- Support for non-AWS endpoints | ||
|
||
## 4.0.13 | ||
- Update gemspec summary | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ | |
require "pathname" | ||
require "aws-sdk" | ||
require "logstash/outputs/s3/patch" | ||
require "uri" | ||
|
||
Aws.eager_autoload! | ||
|
||
|
@@ -64,9 +65,11 @@ | |
# This is an example of logstash config: | ||
# [source,ruby] | ||
# output { | ||
# s3{ | ||
# s3 { | ||
# access_key_id => "crazy_key" (required) | ||
# secret_access_key => "monkey_access_key" (required) | ||
# endpoint => "http://127.0.0.1:8080" (optional, used for non-AWS endpoints, default = "") | ||
# force_path_style => false (optional, used for non-AWS endpoints, default = false) | ||
# region => "eu-west-1" (optional, default = "us-east-1") | ||
# bucket => "your_bucket" (required) | ||
# size_file => 2048 (optional) - Bytes | ||
|
@@ -106,6 +109,13 @@ class LogStash::Outputs::S3 < LogStash::Outputs::Base | |
# S3 bucket | ||
config :bucket, :validate => :string, :required => true | ||
|
||
# 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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
|
||
# When false, specify the bucket in the subdomain. When true, specify the bucket in the path. | ||
config :force_path_style, :validate => :boolean, :default => false | ||
|
||
# Set the size of file in bytes, this means that files on bucket when have dimension > file_size, they are stored in two or more file. | ||
# If you have tags then it will generate a specific size file for every tags | ||
##NOTE: define size of file is the better thing, because generate a local temporary file on disk and then put it in bucket. | ||
|
@@ -270,6 +280,7 @@ def full_options | |
options = Hash.new | ||
options[:signature_version] = @signature_version if @signature_version | ||
options.merge(aws_options_hash) | ||
.merge(endpoint_options) | ||
end | ||
|
||
def normalize_key(prefix_key) | ||
|
@@ -286,6 +297,18 @@ def upload_options | |
} | ||
end | ||
|
||
def endpoint_options | ||
if @endpoint | ||
uri = URI(@endpoint) | ||
{ | ||
:endpoint => @endpoint, | ||
:force_path_style => @force_path_style, | ||
} | ||
else | ||
{} | ||
end | ||
end | ||
|
||
private | ||
# We start a task in the background for check for stale files and make sure we rotate them to S3 if needed. | ||
def start_periodic_check | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is "endpoint" the best name?
Is
http
the right scheme for the url? Citing existing exsample:s3cmd
allowss3://
uris3cmd
config hashost_base
andhost_bucket
for setting hostnames different from AWS S3.s3a://
(and olders3n
ands3
)host
for the endpoint, but not a URL (based on my probably-incomplete research)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
boto.s3.S3Connection
has ahost
parameter that takes an optional port, eg127.0.0.1:8080
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some users want HTTP on trusted networks and others HTTPS on the wider Internet.