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
25 changes: 3 additions & 22 deletions lib/logstash/outputs/s3.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
# INFORMATION:
#
# This plugin batches and uploads logstash events into Amazon Simple Storage Service (Amazon S3).
#
# Requirements:
#
# Requirements:
# * Amazon S3 Bucket and S3 Access Permissions (Typically access_key_id and secret_access_key)
# * S3 PutObject permission
# * Run logstash as superuser to establish connection
Expand Down Expand Up @@ -42,7 +42,7 @@
# Both time_file and size_file settings can trigger a log "file rotation"
# A log rotation pushes the current log "part" to s3 and deleted from local temporary storage.
#
## If you specify BOTH size_file and time_file then it will create file for each tag (if specified).
## If you specify BOTH size_file and time_file then it will create file for each tag (if specified).
## When EITHER time_file minutes have elapsed OR log file size > size_file, a log rotation is triggered.
##
## If you ONLY specify time_file but NOT file_size, one file for each tag (if specified) will be created..
Expand Down Expand Up @@ -258,7 +258,6 @@ def test_s3_write

begin
write_on_bucket(test_filename)
delete_on_bucket(test_filename)
ensure
File.delete(test_filename)
end
Expand Down Expand Up @@ -454,24 +453,6 @@ def reset_page_counter
@page_counter = 0
end

private
def delete_on_bucket(filename)
bucket = @s3.buckets[@bucket]

remote_filename = "#{@prefix}#{File.basename(filename)}"

@logger.debug("S3: delete file from bucket", :remote_filename => remote_filename, :bucket => @bucket)

begin
# prepare for write the file
object = bucket.objects[remote_filename]
object.delete
rescue AWS::Errors::Base => e
@logger.error("S3: AWS error", :error => e)
raise LogStash::ConfigurationError, "AWS Configuration Error"
end
end

private
def move_file_to_bucket_async(file)
@logger.debug("S3: Sending the file to the upload queue.", :filename => File.basename(file))
Expand Down