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

Add config option for ignore_after #87

Closed

Conversation

guyboertje
Copy link
Contributor

NOTES FOR REVIEWERS:

  • This builds on changes in filewatch v0.7.0, now published
  • This builds on changes in the multiline codec v2.0.5, now published
  • Logic: filewatch knowing about close_older, calls timed_out on a file input listener which calls evict(path) on the identity_map_codec which calls auto_flush on the multiline codec and also evicts the identity from the map. Auto_flush should have already assembled and sent the event from any buffered lines if the auto_flush interval is less than the close_older interval.

# set the mode, defaults to "tail"
# in read_to_eof mode filewatch will signal the EOF with a "\x04" control character
# in tail mode behaviour is as before
config :ignore_after, :validate => :number, :default => 24 * 60 * 60
Copy link
Contributor

Choose a reason for hiding this comment

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

Filebeat calls this ignore_older. We talked about being consistent with filebeat to aid any migration to and from these components.

Also, can we add a more descriptive message (copied from filebeat) -

"If this option is specified, file input ignores any files that were modified before the specified timespan in milliseconds. This timeout also triggers a release of resources obtained"

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure, the comment needs to change.
but I spoke to Tudor and they are having real issues with the name and the two functions controlled by one option thing - I asked him to comment on our issue, he did: #81 (comment)

@guyboertje
Copy link
Contributor Author

Jenkins please test this

@guyboertje guyboertje assigned guyboertje and ph and unassigned guyboertje Dec 22, 2015
@@ -1,7 +1,7 @@
Gem::Specification.new do |s|

s.name = 'logstash-input-file'
s.version = '2.0.3'
s.version = '2.0.4'
Copy link
Contributor

Choose a reason for hiding this comment

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

Lets make it 2.1.0. This is new functionality being added

Copy link
Contributor

Choose a reason for hiding this comment

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

+1

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Noted

@ph
Copy link
Contributor

ph commented Dec 22, 2015

This PR doesn't have an update to the changelog.

stop # if the pipeline restarts this input.
@tail = FileWatch::Tail.new(@tail_config)
# if the pipeline restarts this input.
stop
Copy link
Contributor

Choose a reason for hiding this comment

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

The stop here is to close unwanted open fd so we don't leak them?
Might be good to add comment why we actually call stop here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will expand comment

@ph
Copy link
Contributor

ph commented Dec 22, 2015

jenkins test this please

@ph
Copy link
Contributor

ph commented Dec 22, 2015

I did a review of the code, added a few comments.

Also the test are passing locally but not on jenkins. I have modified the jenkins job to clear the workspace before running any test. Without that option we can have cached/incompatible version of the gem available.

I also did a really minimal test of the file input and it look good!

@ph
Copy link
Contributor

ph commented Dec 22, 2015

@guyboertje I was looking the the jenkins jobs that test all the plugins and I have found this problem.
http://build-eu-00.elasticsearch.org/view/LS%20Master/job/Logstash_Master_Default_Plugins/903/console

I think this PR also fix this issue?

  1) LogStash::Inputs::File when wildcard path and a multiline codec is specified collects separate multiple line events from each file
     Failure/Error: expect(events.size).to eq(event_count)

       expected: 2
            got: 0

       (compared using ==)
     # ./vendor/bundle/jruby/1.9/gems/logstash-input-file-2.0.3/spec/inputs/file_spec.rb:242:in `(root)'
     # ./vendor/bundle/jruby/1.9/gems/rspec-wait-0.0.8/lib/rspec/wait.rb:46:in `(root)'
     # ./rakelib/test.rake:72:in `(root)'
     # ./vendor/bundle/jruby/1.9/gems/rake-10.4.2/lib/rake/task.rb:240:in `execute'
     # ./vendor/bundle/jruby/1.9/gems/rake-10.4.2/lib/rake/task.rb:235:in `execute'
     # ./vendor/bundle/jruby/1.9/gems/rake-10.4.2/lib/rake/task.rb:179:in `invoke_with_call_chain'
     # ./vendor/bundle/jruby/1.9/gems/rake-10.4.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
     # ./vendor/bundle/jruby/1.9/gems/rake-10.4.2/lib/rake/task.rb:165:in `invoke'
     # ./vendor/bundle/jruby/1.9/gems/rake-10.4.2/lib/rake/application.rb:150:in `invoke_task'
     # ./vendor/bundle/jruby/1.9/gems/rake-10.4.2/lib/rake/application.rb:106:in `top_level'
     # ./vendor/bundle/jruby/1.9/gems/rake-10.4.2/lib/rake/application.rb:106:in `top_level'
     # ./vendor/bundle/jruby/1.9/gems/rake-10.4.2/lib/rake/application.rb:115:in `run_with_threads'
     # ./vendor/bundle/jruby/1.9/gems/rake-10.4.2/lib/rake/application.rb:100:in `top_level'
     # ./vendor/bundle/jruby/1.9/gems/rake-10.4.2/lib/rake/application.rb:78:in `run'
     # ./vendor/bundle/jruby/1.9/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
     # ./vendor/bundle/jruby/1.9/gems/rake-10.4.2/lib/rake/application.rb:75:in `run'

@guyboertje
Copy link
Contributor Author

Jenkins jobs should work now. All waits are dependent on state change occurring before continue and not guess-work sleeps.

@ph
Copy link
Contributor

ph commented Dec 28, 2015

@jsvd I agree with your comment, but I suggest we create a specific issue for it. this would also allow us to remove the last pieces of insists.

@ph
Copy link
Contributor

ph commented Dec 28, 2015

code LGTM but lets refactor the test in another run?

@guyboertje
Copy link
Contributor Author

+1 on refactoring tests later. Thanks guys.

begin to add ignore_after config option
depends on filewatch 0.6.8

add timed_out method to TailListener and specs

revert Gemfile changes for PR

split and rename ignore_after option, update gem deps to published ver.

bump ver, make suggested review changes and improve spec reliability

update changelog

Fixes logstash-plugins#81, Fixes logstash-plugins#89, Fixes logstash-plugins#90
@elasticsearch-bot
Copy link

Guy Boertje merged this into the following branches!

Branch Commits
master 61142ab

@guyboertje guyboertje deleted the feature/ignore_after branch December 30, 2015 14:09
# was last modified before the specified timespan in seconds, the file is
# ignored. After it's discovery, if an ignored file is modified it is no
# longer ignored and any new data is read. The default is 24 hours.
config :ignore_older, :validate => :number, :default => 24 * 60 * 60
Copy link

Choose a reason for hiding this comment

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

@guyboertje I'm currently adding the close_older function also the filebeat. As we have now ignore_older and close_older, I suggest to set ignore_older to at least 72 hours or even "infinite" by default. The reasoning behind this is that we had some edge cases in the past. Any thoughts? https://github.com/elastic/filebeat/issues/181

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

Successfully merging this pull request may close these issues.

5 participants