-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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: fluent-bit reads wrong offsets when two file have the same name and the same inode on linux system. #1875
Comments
…1875) The following patch fix the old behavior of keep the file references in the database when the files get deleted from the file system or rotated and not being longer monitored. Upon file deletion from the filesystem or it rotation, the entry is removed from the database. Signed-off-by: Eduardo Silva <[email protected]>
@edsiper |
…1875) The following patch fix the old behavior of keep the file references in the database when the files get deleted from the file system or rotated and not being longer monitored. Upon file deletion from the filesystem or it rotation, the entry is removed from the database. Signed-off-by: Eduardo Silva <[email protected]>
@wtan825 I don't understand the last problem described. We stop monitoring a file only if the file gets deleted or rotated. |
@edsiper Now We just stop monitoring a file only if the file gets deleted or rotated. But in some circumstances we hope to stop monitoring a inactive file. For instance, when we monitoring a directory, the path is set to /var/applog/*. If we do not stop monitoring a inactive file, too many files will be monitored. filebeat has this feature which could stop monitoring a inactive file. |
@wtan825 what would be the expected solution from a configuration perspective ? something like: inactive_timeout = 30; where after 30 seconds if the file don't get any new data just stop monitoring it and discard it ? (even if after a minute it gets more data?) |
@edsiper yes. for instance, inactive_timeout = 1d. after 1d if the file don't get any new data, we just stop monitoring it. but still keep offset. offset will be deleted only after the file is deleted. |
@edsiper Can this fix be applied to fluent-bit 1.2.2 ? |
@srini38 nop, all fixes are being applied now on the v1.4 series. |
@edsiper Sorry I should have been clearer. Can I apply this to my copy of fluent-bit 1.2.2 code. Do you see any issues? |
hmm not 100% sure, but you will have to try. why not upgrade to the latest v1.4.2 ? |
@edsiper Will try it out. Unfortunately cannot upgrade to 1.4.x now. |
We have implemented other fixes to detect files rotation, please use v1.4.6 to get the solution in place. ref: https://fluentbit.io/announcements/v1.4.6/ closing as fixed. |
@edsiper, @patrick-stephens , what's the latest version which has the fix for this issue? does this fix work for upgrade scenario? |
@edsiper, @patrick-stephens , can you guys help on triaging this issue - #4895 as we have couple of customers waiting for the fix? |
It looks like there is an open issue for it so will leave it with that. They may be related, I'm not sure and not really the expert so will leave others to comment there. |
|
it looks even two files with different file names, when the old file is deleted, but the stale data in sqllite db will lead the offset issue. Then it will cause the log file output truncated. |
Bug Report
Describe the bug
when i read the code, i find that fluent-bit use file name and inode to set the checkpoints in db.(https://github.com/fluent/fluent-bit/blob/master/plugins/in_tail/tail_db.c line 109). the problem is after file (named A) is deleted, another file ( also named A) created with the same inode. fluent-bit will read the old A's offset.
To Reproduce
in mnt, delete a.log, then create a.log. the two files may have the same inode. besides, two files which have the same name in different device may have the same inode.
![image](https://user-images.githubusercontent.com/30097191/72333244-6f934a80-36f6-11ea-86ff-d5ebb3cc8189.png)
![image](https://user-images.githubusercontent.com/30097191/72333323-8df94600-36f6-11ea-8461-c981a48d0a0c.png)
Expected behavior
when two files have the same name and the same inode in different time would not affect each other
Your Environment
linux
The text was updated successfully, but these errors were encountered: