Skip to content
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

Support for dynamic prefix field based s3 directory separation #44

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

elyscape
Copy link

Based on #33, but rebased and with author's email set to the personal one listed on his GitHub profile, which is likely the address @nigoel used to sign the CLA.

From #33's description:

One may not provide the dynamic prefixes like "logs/%{app}/%{type}/" . Fields can be extracted from the event messages.

This will create the temp file locally per prefix and apply a time_file watch on each prefix. Change also maintains a separate file lock for each prefix.

After no_event_wait time, it will reset the watch and do a local clean-up for the files under a prefix. This will happen if there has been no event for that prefix, in last no_event_wait * time_file time from the last event.

Closes #33.

@nigoel
Copy link

nigoel commented Oct 29, 2015

Thanks @elyscape . I was struggling with the CLA. Thanks for updating it.

@sijis
Copy link

sijis commented Nov 1, 2015

I'm really looking forward to this.

@elasticsearch-release
Copy link

Jenkins standing by to test this. If you aren't a maintainer, you can ignore this comment. Someone with commit access, please review this and clear it for Jenkins to run; then say 'jenkins, test it'.

@suyograo
Copy link

suyograo commented Nov 4, 2015

@elyscape can you please add tests to validate these changes?

@elyscape
Copy link
Author

elyscape commented Nov 4, 2015

I'll take a look. @nigoel, if you can help on this some, that would be very appreciated.

@@ -8,6 +8,7 @@
require "thread"
require "tmpdir"
require "fileutils"
require 'pathname'
Copy link
Contributor

Choose a reason for hiding this comment

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

Lets use the same style as the other requires

require "pathname"

@ph
Copy link
Contributor

ph commented Nov 5, 2015

@elyscape @nigoel this will take a bit more time, I need to check if there any thread safety problems.

reset_page_counter
create_temporary_file
#reset_page_counter
#create_temporary_file
Copy link
Contributor

Choose a reason for hiding this comment

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

We can remove this.

@sijis
Copy link

sijis commented Nov 24, 2015

Is there something I can do to get this moved on? Is it simply fixing the notes provided by @ph?

@nigoel
Copy link

nigoel commented Nov 25, 2015

Thanks for the review. I will incorporate them.

@nigoel
Copy link

nigoel commented Nov 26, 2015

@elyscape @ph I am not able to create a direct pull request to this because of CLA issues.
I have created a pull request with changes incorporated in elyscape repo.@elyscape please help me here.

@elyscape
Copy link
Author

Sorry for the delay. Grabbed the changes from @nigoel and added them into this PR with fixed authorship.

@NoumanSaleem
Copy link

Would love to see this

@jsvd jsvd added the P3 label Apr 26, 2016
ph added a commit to ph/logstash-output-s3 that referenced this pull request Dec 15, 2016
**Motivation**
One of the most requested features was adding a way to add dynamic prefixes using the fieldref
syntax for the files on the bucket and also the changes in the pipeline to support shared delegator.
The S3 output by nature was always a single threaded writes but had multiples workers to process the upload, the code was threadsafe when used in the concurrency `:single` mode.

This PR addresses a few problems and provide shorter and more structured code:
- This Plugin now uses the V2 version of the SDK, this make sure we receive the latest updates and changes.
- We now uses S3's `upload_file` instead of reading chunks, this method is more efficient and will uses the multipart with threads if the files is too big.
- You can now use the `fieldref` syntax in the prefix to dynamically changes the target with the events it receives.
- The Upload queue is now a bounded list, this options is necessary to allow back pressure to be communicated back to the pipeline but its configurable by the user.
- If the queue is full the plugin will start the upload in the current thread.
- The plugin now threadsafe and support the concurrency model `shared`
- The rotation strategy can be selected, the recommended is `size_and_time` that will check for both the configured limits (`size` and `time` are also available)
- The `restore` option will now use a separate threadpool with an unbounded queue
- The `restore` option will not block the launch of logstash and will uses less resources than the real time path
- The plugin now uses `multi_receive_encode`, this will optimize the writes to the files
- rotate operation are now batched to reduce the number of IO calls.
- Empty file will not be uploaded by any rotation rotation strategy
- We now use Concurrent-Ruby for the implementation of the java executor
- If you have finer grain permission on prefixes or want faster boot, you can disable the credentials check with `validate_credentials_on_root_bucket`
- The credentials check will no longer fails if we can't delete the file
- We now have a full suite of integration test for all the defined rotation

Fixes: logstash-plugins#4 logstash-plugins#81 logstash-plugins#44 logstash-plugins#59 logstash-plugins#50
elasticsearch-bot pushed a commit that referenced this pull request Dec 15, 2016
**Motivation**
One of the most requested features was adding a way to add dynamic prefixes using the fieldref
syntax for the files on the bucket and also the changes in the pipeline to support shared delegator.
The S3 output by nature was always a single threaded writes but had multiples workers to process the upload, the code was threadsafe when used in the concurrency `:single` mode.

This PR addresses a few problems and provide shorter and more structured code:
- This Plugin now uses the V2 version of the SDK, this make sure we receive the latest updates and changes.
- We now uses S3's `upload_file` instead of reading chunks, this method is more efficient and will uses the multipart with threads if the files is too big.
- You can now use the `fieldref` syntax in the prefix to dynamically changes the target with the events it receives.
- The Upload queue is now a bounded list, this options is necessary to allow back pressure to be communicated back to the pipeline but its configurable by the user.
- If the queue is full the plugin will start the upload in the current thread.
- The plugin now threadsafe and support the concurrency model `shared`
- The rotation strategy can be selected, the recommended is `size_and_time` that will check for both the configured limits (`size` and `time` are also available)
- The `restore` option will now use a separate threadpool with an unbounded queue
- The `restore` option will not block the launch of logstash and will uses less resources than the real time path
- The plugin now uses `multi_receive_encode`, this will optimize the writes to the files
- rotate operation are now batched to reduce the number of IO calls.
- Empty file will not be uploaded by any rotation rotation strategy
- We now use Concurrent-Ruby for the implementation of the java executor
- If you have finer grain permission on prefixes or want faster boot, you can disable the credentials check with `validate_credentials_on_root_bucket`
- The credentials check will no longer fails if we can't delete the file
- We now have a full suite of integration test for all the defined rotation

Fixes: #4 #81 #44 #59 #50

Fixes #102
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants