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 follow_only_path flag to dumb down filewatching to just paths #34

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

michio-nikaido
Copy link

I'm putting together a Logstash deployment which involves a number of production servers regularly rsync'ing files to a central log repository. When running Logstash from this central server, it appears that the filewatch code behind the Logstash 'file' input is detecting the updated inode on each rsync and treating the file as new.

The changes here allow a 'follow_only_path' flag to be specified that causes the inode variable to be constructed from the file path rather than the file's inode. This allows the inode variable to remain the same after an rsync updates the file's inode, allowing the @sincedb lookup to file the same entry and continue parsing the file from where it left off

@michio-nikaido
Copy link
Author

Had to do a little special case handling of paths with spaces/carriage returns in them to prevent parsing errors in _sincedb

@wiibaa
Copy link
Contributor

wiibaa commented Feb 26, 2015

@michio-nikaido could you please rebase your PR against current master, the creation of the sincedb_identifier is now in its own method so your code and superb comment should go here please https://github.com/jordansissel/ruby-filewatch/blob/master/lib/filewatch/tail.rb#L110

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.

2 participants