-
Notifications
You must be signed in to change notification settings - Fork 101
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
Ability to terminate pipeline when EOF reached #240
Ability to terminate pipeline when EOF reached #240
Conversation
Can anybody at least take a look there and let me know if the approach is correct? |
Would be nice if this functionality could be merged soon. |
Any chance to merge this change? Or this plugin is no longer in active development? |
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.
@BigYellowHammer, thanks for this contribution to the input-file plugin and the docs! I have reviewed the docs. Nice job describing the new option and its use! One request: Please consider moving the new option to alpha order rather than operational order. That standard makes it easier for users to track down options.
@gregorysl Thanks for the ping. I have reviewed the docs, and requested a tech review for the plugin. |
@karenzone Attributes ordering is fixed. |
Hi @BigYellowHammer it's probably better to separate the bugfix of WatchedFilesCollection in a separate PR. |
Hi @andsel WatchedFilesCollection fix is essential for my exit_after_read flag to work |
@BigYellowHammer we could work before on the bugfix, and then progress with this one after a rebase of the code |
@andsel ok will try to prepare new PR this week |
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.
@BigYellowHammer Docs LGTM. Builds cleanly and looks great! Thanks for your contribution.
If you need to make additional docs changes and would like for me to take another look, please ping me.
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 notes after running it with a pipeline and some files
# handlers take care of closing and unwatching | ||
end | ||
end | ||
|
||
def common_detach_when_allread(watched_file) | ||
watched_file.unwatch | ||
watched_file.listener.reading_completed |
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.
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.
Method common_detach_when_allread
It's like the method common_deleted_reaction
, I think we could simply put call common_deleted_reaction(watched_file, "Completed")
and avoid common_detach_when_allread
. What do you think?
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 changed it, just added the missed callback reading_completed
method to LogStash::Inputs::FileListener
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 wanted to keep my functionality separate from the main code. Plus common_deleted_reaction
is more like error handling method when the file gets deleted IMO. In order to merge those methods I will have to put if
inside common_deleted_reaction
base on the action and this action is string so it might be error prone to spelling mistakes. So I would rather keep them separate or change string to enum if we really want to merge it.
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.
@BigYellowHammer I agree with you, the commit 82e58b0 has fixed that
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.
@andsel build failed? Do you think it's intermittent. Can we retrigger?
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 saw, and restarting make it always fails. I try to reproduce locally
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.
@BigYellowHammer the error happens also on master, so it's not related to this PR
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.
@andsel do we even need this "an interruptible input plugin" shared example? is it used by some libraries above? because I don't see any direct usage in logstash-input-file
spec folder
82e58b0
to
6452aa3
Compare
…ine once it red all files. Closes logstash-plugins#212
6452aa3
to
6ac2ea8
Compare
Andrea Selva merged this into the following branches!
|
@BigYellowHammer many thanks for your contribution with this PR |
Adding ability to terminate pipeline when EOF reached (#212)
Change is backwards compatible. When flag is set to 'false' - no change to code execution.
Changes:
* Adding exit_after_read flag to config
* Disable active discovery when exit_after_read set to true
* Remove file from watched_file_collection when EOF reached and flag set to true
* Adding condition to exit when file collection is empty and flag set to true
* Fixing WatchedFilesCollection delete method bug (unable to delete multiple files with 1 method call)
* Adding exception when exit_after_read it set to true in tail mode
Fixes #212