-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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 take long time to found rotated files #2478
Comments
It seems if we don't break the read loop at https://github.com/fluent/fluentd/blob/master/lib/fluent/plugin/in_tail.rb#L741, in_tail would take very long time to setup_watcher and read content from other file if log files is big. |
Does this mean detecting new file takes longer time, not reading data, right? How about this parameter? https://docs.fluentd.org/input/tail#skip_refresh_on_startup
I see. I understood the backgroud of previous issue. Current implementation is mainly for hit EOF frequently so your approach is considerable. |
Yes. But there is also another problem, if Changing
already set to be true
The modified version of in_tail has been running for 2 days, and it looks fine(I'm not sure if there are potential issues). I want to know what kind of risk it would be if I change I don't get the meaning of |
Good to hear that no problem on your production. we check the several situations with your suggestion and if no problem, the change will be included in v1.7.0. |
I'm sorry there is bad news. I found that there may be some record lost. I add some log to print the file size and the fd pos when the io handler is closed and I found that sometimes the io handler is closed before fd.pos reach the end of the file, this means some records are lost forever.
I think I get the meaning of that now. When rotate happens, in_tail would wait just 5 seconds according to the default rotate_wait setting. I guess when read_more = true, handle_notify would always hit the end of the file(not very sure). But when read_more=false, in_tail would only continue read the file for rotate_wait seconds and read 8192 byte (according to io.readpartial(8192, @iobuf)) for each time. So if fd.pos is far away from the file size or the flush speed of the output is slow, when the file is rotated, records at the end of the file are lost. I resolve this by setting rotate_wait to a bigger value(the value is determined by testing in_tail against out log generate speed and output flush speed). But I don't know if it's suitable for fluentd.
These two problems remain, and the root cause of them is not clear. Changing read_more=true to read_more=false maybe not a good solution. |
Signed-off-by: Masahiro Nakagawa <[email protected]>
I aslo modify read_more to false ago; In my test environment, this change will reduce the CPU usage of fluentd process but will aslo decrese the performance。 |
#3185 (with #3364 and #3379) has been merged, which is similar fix with #2525. TODO:
It's not addressed in #3185 yet. Probably it should keep reading until reached to EOF. |
Fix fluent#2478 Signed-off-by: Takuro Ashie <[email protected]>
Fix fluent#2478 Signed-off-by: Takuro Ashie <[email protected]>
Fix fluent#2478 Signed-off-by: Takuro Ashie <[email protected]>
Fix fluent#2478 Signed-off-by: Takuro Ashie <[email protected]>
Fix fluent#2478 Signed-off-by: Takuro Ashie <[email protected]>
WIP: #3390 |
Fix fluent#2478 Signed-off-by: Takuro Ashie <[email protected]>
Fix fluent#2478 Signed-off-by: Takuro Ashie <[email protected]>
Fix fluent#2478 Signed-off-by: Takuro Ashie <[email protected]>
related to issue #2477
Will there be any risk if I change read_more = true to read_more = false, such as losing record or other issues, just in my copy of in_tail source code?
We came across a problem here. We have ten log files, our log-generator writes record(0.5KB per record) to them by 1000 lines/s each and rotate it by renaming the file to another name(the inode changed but filename stay the same) if the size of the file reaches 100MB. We use in_tail to collect these files.
We found two problems.
I'm not familiar with in_tail's performance, so maybe it's not in_tail's problem but the way I use it. The usage of CPU is not high and the flush speed is ok.
For the moment, I solve these two problems with change read_more = true to read_more = false(it take effects), but I'm not sure if there will be any risk with this change.
It would be very kind of you if you can give me some advice with these two problems.
The text was updated successfully, but these errors were encountered: