-
Notifications
You must be signed in to change notification settings - Fork 3.5k
temp_directory can now be modified in conf file #1344
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 |
|---|---|---|
|
|
@@ -14,7 +14,7 @@ | |
|
|
||
| # S3 plugin allows you to do something complex, let's explain:) | ||
|
|
||
| # S3 outputs create temporary files into "/opt/logstash/S3_temp/". If you want, you can change the path at the start of register method. | ||
| # S3 outputs create temporary files into "/opt/logstash/S3_temp/" or in to the temp_directory you specify in your conf. If | ||
| # This files have a special name, for example: | ||
|
|
||
| # ls.s3.ip-10-228-27-95.2013-04-18T10.00.tag_hello.part0.txt | ||
|
|
@@ -72,7 +72,7 @@ | |
| # time_file => 5 (optional) | ||
| # format => "plain" (optional) | ||
| # canned_acl => "private" (optional. Options are "private", "public_read", "public_read_write", "authenticated_read". Defaults to "private" ) | ||
| # } | ||
| # temp_directory => "/tmp/s3_temp" (optional. Defaults to "/opt/logstash/S3_temp/") | ||
| # } | ||
|
|
||
| # We analize this: | ||
|
|
@@ -135,6 +135,9 @@ class LogStash::Outputs::S3 < LogStash::Outputs::Base | |
| # 0 stay all time on listerner, beware if you specific 0 and size_file 0, because you will not put the file on bucket, | ||
| # for now the only thing this plugin can do is to put the file when logstash restart. | ||
| config :time_file, :validate => :number, :default => 0 | ||
|
|
||
| #Set the directory where temporary files are stored. | ||
| config :temp_directory, :validate => :string, :default => "/opt/logstash/S3_temp/" | ||
|
|
||
| # The event format you want to store in files. Defaults to plain text. | ||
| config :format, :validate => [ "json", "plain", "nil" ], :default => "plain" | ||
|
|
@@ -204,7 +207,7 @@ def write_on_bucket (file_data, file_basename) | |
| def getFinalPath | ||
|
|
||
| @pass_time = Time.now | ||
| return @temp_directory+"ls.s3."+Socket.gethostname+"."+(@pass_time).strftime("%Y-%m-%dT%H.%M") | ||
| return @temp_directory+"/ls.s3."+Socket.gethostname+"."+(@pass_time).strftime("%Y-%m-%dT%H.%M") | ||
|
Contributor
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. File.join should be used here to build paths. I know there are inconsistencies with this in the codebase. |
||
|
|
||
| end | ||
|
|
||
|
|
@@ -253,7 +256,6 @@ def newFile (flag) | |
| public | ||
| def register | ||
| require "aws-sdk" | ||
| @temp_directory = "/opt/logstash/S3_temp/" | ||
|
|
||
| if (@tags.size != 0) | ||
| @tag_path = "" | ||
|
|
@@ -266,7 +268,7 @@ def register | |
| @logger.debug "S3: Directory "+@temp_directory+" doesn't exist, let's make it!" | ||
| Dir.mkdir(@temp_directory) | ||
| else | ||
| @logger.debug "S3: Directory "+@temp_directory+" exist, nothing to do" | ||
| @logger.debug "S3: Directory "+@temp_directory+" exists, nothing to do" | ||
| end | ||
|
|
||
| if (@restore == true ) | ||
|
|
||
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.
I think the default should be the system's temporary directory.
Dir.tmpdirusually reports this.