fluent-bit icon indicating copy to clipboard operation
fluent-bit copied to clipboard

log: Log File size limit and Log rotation for fluent-bit logs

Open phiremande opened this issue 5 years ago • 26 comments

Currently fluent-bit logs can be redirected to a file using Log_File. But there is no configuration option to limit the size of the file. Additionally, there is no log rotation that can be enabled for fluent-bit logs. These might be useful when we want to collect fluent-bit process logs itself and also to debug.

Added new configuration parameters: Log_File_Size - Size limit in MB for the file specified by Log_File. Log_File_History - Max number of backups to be kept. These backups are kept as <Log_File>.1, <Log_File>.2 etc.

Sample configuration. [SERVICE] Flush 1 Daemon Off Log_Level debug Log_File ./fb_log.log Log_File_Size 1
Log_File_History 2

This PR has the corresponding changes.

phiremande avatar Jan 18 '20 10:01 phiremande

@edsiper , kindly let me know if you have any further suggestions.

phiremande avatar Sep 03 '20 06:09 phiremande

@edsiper , please let me know if this PR still makes sense and are there any plans to merge this.

phiremande avatar Jan 19 '22 04:01 phiremande

thanks for this PR.

I added some minor change requests before to get this merged we need to sort out two things:

* rebase on top of GIT master

* all I/O functions must work on Linux and Windows, .eg: remove(3) is not valid on windows

Kindly let me know if the changes look fine now. If you have any more suggestions please do let me know. Also should I use "log" or "engine" in the commit message?

phiremande avatar Jan 21 '22 12:01 phiremande

You may need a rebase to solve the fuzzing failures but the unit tests also need resolving. There seems to be quite a few failures which will prevent merging.

patrick-stephens avatar Apr 07 '22 21:04 patrick-stephens

You may need a rebase to solve the fuzzing failures but the unit tests also need resolving. There seems to be quite a few failures which will prevent merging.

@patrick-stephens , I have rebased and fixed UT failures. Can you please let me know what should be the commit message? I guess the 1 failure is due to component missing in commit message.

phiremande avatar Apr 09 '22 00:04 phiremande

Yeah you need it in the format: component: message

patrick-stephens avatar Apr 09 '22 14:04 patrick-stephens

@patrick-stephens , please do let me know if there is anything else pending from my side.

phiremande avatar Apr 10 '22 00:04 phiremande

Looks to me like you just need to verify @edsiper review comments are addressed.

patrick-stephens avatar Apr 11 '22 10:04 patrick-stephens

@edsiper , I have addressed your comments. Please do let me know if you still have any concerns.

phiremande avatar Apr 11 '22 11:04 phiremande

@phiremande did you set up the docs PR as well? Can you link it so we can merge that once this is merged?

patrick-stephens avatar Apr 11 '22 16:04 patrick-stephens

@patrick-stephens can you pls verify functionality of this new feature ?

edsiper avatar Apr 26 '22 00:04 edsiper

Will do, should this PR cover Windows & Linux functionality so it works on both?

patrick-stephens avatar May 11 '22 19:05 patrick-stephens

@patrick-stephens both ideally

edsiper avatar Aug 26 '22 19:08 edsiper

@patrick-stephens When will this PR merge into the master branch?

qihonggang avatar Nov 25 '22 07:11 qihonggang

Apologies I've had little time to look at this so far but will endeavour to soon. It can't be merged right now anyway as it has a conflict.

patrick-stephens avatar Nov 25 '22 10:11 patrick-stephens

Hi Team, Any update on this request? This would be very helpful.

said1995 avatar May 29 '23 06:05 said1995

Apologies, I've still not tested this yet.

patrick-stephens avatar May 30 '23 08:05 patrick-stephens

Hi team, Any thoughts on when would this be merged?

ustndagsemih avatar Jun 26 '23 08:06 ustndagsemih

Any update on this one, I think it would be very valuable to have predictable log sizes for fluent bit itself.

Hey @phiremande, are you going to finish this PR? I can continue to work on it as I really need these changes.

wojciechtobis avatar Oct 02 '23 15:10 wojciechtobis

Hey everyone, I'm grateful for the work that has already been carried out on this issue. The log file size limit and rotation would be very useful to us to prevent disk utilisation issues caused by fluent-bit.

Is there an update as to when the changes will be merged?

hcdmonitor avatar Nov 21 '23 10:11 hcdmonitor

Hey everyone, I'm grateful for the work that has already been carried out on this issue. The log file size limit and rotation would be very useful to us to prevent disk utilisation issues caused by fluent-bit.

Is there an update as to when the changes will be merged?

It needs rebasing and updating so if you pick it up @hcdmonitor it may speed things up.

patrick-stephens avatar Nov 21 '23 10:11 patrick-stephens

Hello everyone, I'm also interested in this feature! Am I correct assuming that the only way of rebasing here is to open a new PR @patrick-stephens @hcdmonitor ? I don't think anyone except @phiremande has permissions to push to phiremande:log-rotate branch. Please let me know if I'm wrong.

etolbakov avatar Dec 22 '23 16:12 etolbakov