-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
in_tail: fix symlink log rotation for fs_stat on linux #2052
in_tail: fix symlink log rotation for fs_stat on linux #2052
Conversation
When compiled with FLB_HAVE_INOTIFY=no for linux records were continuously resent if the files in PATH are symlinks. This patch ensures the fs_stat file monitoring correctly handles symlinks when checking for file rotations. The issue was found when running fluentbit as a daemonset in kubernetes where all files in /var/log/containers/* are symlinks. This patch was tested by forwarding 1M records of 1K size when compiled with both FLB_HAVE_INOTIFY=no/yes and verifying the output metrics reported exactly 1M records. The test was executed by running a container logging to stdout in a kubernetes cluster where symlinks are the target input. Further docker was configured to rotate logs at 10M to ensure multiple file rotations occurred. Signed-off-by: Zack Wine <[email protected]>
fluent-bit.conf
Debug log simulating 3 log rotations:
|
Valgrind results:
|
@zackwine I think I can take time for this patch somewhere this week. |
@edsiper @zackwine Sorry for being late. I can confirm this fix is correct. I set up the testing environment as below:
When I moved the log.txt to log.txt.1, Fluent Bit detects the rotation This patch should be good to be merged into mainline. |
Thanks @fujimotos. I can also confirm I have been running load tests with these changes for over a month in a Kubernetes environment. Is there a timeline on when this will be merged? |
thanks @fujimotos for the review and @zackwine for the fix. This is being merged now. |
When compiled with FLB_HAVE_INOTIFY=no for linux records were continuously resent if the files in PATH are symlinks. This patch ensures the fs_stat file monitoring correctly handles symlinks when checking for file rotations. The issue was found when running fluentbit as a daemonset in kubernetes where all files in /var/log/containers/* are symlinks. This patch was tested by forwarding 1M records of 1K size when compiled with both FLB_HAVE_INOTIFY=no/yes and verifying the output metrics reported exactly 1M records. The test was executed by running a container logging to stdout in a kubernetes cluster where symlinks are the target input. Further docker was configured to rotate logs at 10M to ensure multiple file rotations occurred. Signed-off-by: Zack Wine <[email protected]>
When compiled with FLB_HAVE_INOTIFY=no for linux, records were continuously
resent if the files in PATH are symlinks. This patch ensures the fs_stat file
monitoring correctly handles symlinks when checking for file rotations.
The issue was found when running fluentbit as a daemonset in kubernetes where all
files in /var/log/containers/* are symlinks.
This patch was tested by forwarding 1M records of 1K size when compiled with
both FLB_HAVE_INOTIFY=no/yes and verifying the output metrics reported exactly
1M records. The test was executed by running a container logging to stdout
in a kubernetes cluster where symlinks are the target input. Further docker
was configured to rotate logs at 10M to ensure multiple file rotations
occurred.
Signed-off-by: Zack Wine [email protected]
Enter
[N/A]
in the box, if an item is not applicable to your change.Testing
Before we can approve your change; please submit the following in a comment:
Documentation
Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.