-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Improve handling of different path variants on Windows #3781
Merged
Conversation
This file contains 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
ruflin
force-pushed
the
improve-glob-handling
branch
from
March 21, 2017 12:42
287f0e1
to
9d122f9
Compare
ruflin
added
the
needs_backport
PR is waiting to be backported to other branches.
label
Mar 21, 2017
This should be backported to 5.3. |
ruflin
force-pushed
the
improve-glob-handling
branch
from
March 21, 2017 12:44
9d122f9
to
fafac98
Compare
ruflin
changed the title
Cleanup Paths and Glob before comparing
Improve handling of different path variants on Windows
Mar 21, 2017
If forward slashes were used on Windows the glob was not matching on startup which lead to the issue that data was resent. This is solved in 5.3 by using path.Abs for all paths which also includes Clean. To make sure Path and Glob are always clean, Cleanup was added to the MatchFile part. This makes sure in case old data / incorrect data is loaded, the comparison will still work. More tests were added for windows to verify change. Before this change, option 1 below did not work. ``` "F:/wwwLogs/flights-wsapi/WebServicesWebApi.log" "F:\\wwwLogs\\flights-wsapi\\WebServicesWebApi.log" 'F:\wwwLogs\flights-wsapi\WebServicesWebApi.log' ``` Based on https://discuss.elastic.co/t/duplicate-events-with-filebeat-on-windows-on-service-restart/78743/10
ruflin
force-pushed
the
improve-glob-handling
branch
from
March 21, 2017 12:45
fafac98
to
ce72b17
Compare
andrewkroh
reviewed
Mar 21, 2017
} | ||
// Path and glob are cleaned to ensure we always compare clean paths | ||
glob = filepath.Clean(glob) | ||
filePath = filepath.Clean(filePath) |
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.
It looks like cleaning filePath
could be done only once if it were outside of the for
loop.
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.
changed
ruflin
added a commit
to ruflin/beats
that referenced
this pull request
Mar 22, 2017
* Improve handling of different path variants on Windows If forward slashes were used on Windows the glob was not matching on startup which lead to the issue that data was resent. This is solved in 5.3 by using path.Abs for all paths which also includes Clean. To make sure Path and Glob are always clean, Cleanup was added to the MatchFile part. This makes sure in case old data / incorrect data is loaded, the comparison will still work. More tests were added for windows to verify change. Before this change, option 1 below did not work. ``` "F:/wwwLogs/flights-wsapi/WebServicesWebApi.log" "F:\\wwwLogs\\flights-wsapi\\WebServicesWebApi.log" 'F:\wwwLogs\flights-wsapi\WebServicesWebApi.log' ``` Based on https://discuss.elastic.co/t/duplicate-events-with-filebeat-on-windows-on-service-restart/78743/10 * Move clean path outside for loop (cherry picked from commit 4527162)
tsg
pushed a commit
that referenced
this pull request
Mar 22, 2017
* Improve handling of different path variants on Windows If forward slashes were used on Windows the glob was not matching on startup which lead to the issue that data was resent. This is solved in 5.3 by using path.Abs for all paths which also includes Clean. To make sure Path and Glob are always clean, Cleanup was added to the MatchFile part. This makes sure in case old data / incorrect data is loaded, the comparison will still work. More tests were added for windows to verify change. Before this change, option 1 below did not work. ``` "F:/wwwLogs/flights-wsapi/WebServicesWebApi.log" "F:\\wwwLogs\\flights-wsapi\\WebServicesWebApi.log" 'F:\wwwLogs\flights-wsapi\WebServicesWebApi.log' ``` Based on https://discuss.elastic.co/t/duplicate-events-with-filebeat-on-windows-on-service-restart/78743/10 * Move clean path outside for loop (cherry picked from commit 4527162)
monicasarbu
added
v5.3.0
and removed
needs_backport
PR is waiting to be backported to other branches.
labels
Mar 28, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
If forward slashes were used on Windows the glob was not matching on startup which lead to the issue that data was resent. This is solved in 5.3 by using path.Abs for all paths which also includes Clean. To make sure Path and Glob are always clean, Cleanup was added to the MatchFile part. This makes sure in case old data / incorrect data is loaded, the comparison will still work. More tests were added for windows to verify change.
Before this change, option 1 below did not work.
Based on https://discuss.elastic.co/t/duplicate-events-with-filebeat-on-windows-on-service-restart/78743/10