Skip to content
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

Why missing log in tail input plugin when rotate file #9580

Open
myabcc17 opened this issue Nov 12, 2024 · 2 comments
Open

Why missing log in tail input plugin when rotate file #9580

myabcc17 opened this issue Nov 12, 2024 · 2 comments

Comments

@myabcc17
Copy link

myabcc17 commented Nov 12, 2024

Bug Report

Describe the bug
Logs before or after the file is rotated are not tracked.
Rotate_Wait, Refresh_Interval is the default value, but this amount was expected to be sufficiently tracked.

But there are untraceable numbers in between.

why is fluent-bit like this? Is that the intended move?

In real business logic, larger files are rotated every 5 minutes, but we tested them like this to reproduce similar issues in simple situations.

To Reproduce

  • Steps to reproduce the problem:
  1. Run fluent-bit with tail input plugin for '/logs/test' file
  2. Exec below script for collect log.
    it is overwrite the file every multiple of 10 to imitate lotate file. and other numbers are added to the file.
#!/bin/bash

for i in {1..50}
do
  if (( $i % 10 == 0 ))
  then
     echo "Overwrite: $i" > /logs/test
  else
    echo "Append: $i" >> /logs/test
  fi
done

Expected behavior
Fluent-bit must be able to log all numbers from 1 to 50.

Screenshots
However, if you look at the log before or after the file is rotated, there are numbers that are not logged.

Why did you do this?

2024/11/12 08:44:22] [debug] [input:tail:tail.0] inode=39457440 events: IN_MODIFY
[2024/11/12 08:44:22] [debug] [input:tail:tail.0] inode=39457440 file truncated /logs/test
[2024/11/12 08:44:22] [debug] [input:tail:tail.0] inode=39457440 events: IN_MODIFY
[2024/11/12 08:44:22] [debug] [input:tail:tail.0] inode=39457440 file truncated /logs/test
[2024/11/12 08:44:22] [debug] [input:tail:tail.0] inode=39457440 events: IN_MODIFY
[2024/11/12 08:44:22] [debug] [input:tail:tail.0] inode=39457440 events: IN_MODIFY
[2024/11/12 08:44:22] [debug] [input:tail:tail.0] inode=39457440 file truncated /logs/test
[2024/11/12 08:44:22] [debug] [input:tail:tail.0] inode=39457440 events: IN_MODIFY
[2024/11/12 08:44:22] [debug] [input:tail:tail.0] inode=39457440 events: IN_MODIFY
[2024/11/12 08:44:22] [debug] [input:tail:tail.0] inode=39457440 file truncated /logs/test
[2024/11/12 08:44:22] [debug] [input:tail:tail.0] inode=39457440 events: IN_MODIFY
[2024/11/12 08:44:22] [debug] [input:tail:tail.0] inode=39457440 events: IN_MODIFY
[2024/11/12 08:44:22] [debug] [input:tail:tail.0] inode=39457440 events: IN_MODIFY
[2024/11/12 08:44:22] [debug] [input:tail:tail.0] inode=39457440 file truncated /logs/test
[2024/11/12 08:44:22] [debug] [input:tail:tail.0] inode=39457440 events: IN_MODIFY
[2024/11/12 08:44:22] [debug] [task] created task=0x7f5890a5c820 id=0 OK
[2024/11/12 08:44:22] [debug] [task] destroy task=0x7f5890a5c820 (task_id=0)
[0] tlog: [1731401062.256527812, {"log"=>"Append: 1"}]
[1] tlog: [1731401062.256531118, {"log"=>"Append: 2"}]
[2] tlog: [1731401062.256531522, {"log"=>"Append: 3"}]
[3] tlog: [1731401062.256531924, {"log"=>"Append: 4"}]
[4] tlog: [1731401062.256532362, {"log"=>"Append: 5"}]
[5] tlog: [1731401062.256532763, {"log"=>"Append: 6"}]
[6] tlog: [1731401062.256533256, {"log"=>"Append: 7"}]
[7] tlog: [1731401062.256533679, {"log"=>"Append: 8"}]
[8] tlog: [1731401062.256534102, {"log"=>"Append: 9"}]
[9] tlog: [1731401062.256756323, {"log"=>"Overwrite: 10"}]
[10] tlog: [1731401062.256756975, {"log"=>"Append: 11"}]
[11] tlog: [1731401062.256757431, {"log"=>"Append: 12"}]
[12] tlog: [1731401062.256757882, {"log"=>"Append: 13"}]
[13] tlog: [1731401062.256758328, {"log"=>"Append: 14"}]
[14] tlog: [1731401062.256758777, {"log"=>"Append: 15"}]
[15] tlog: [1731401062.256759175, {"log"=>"Append: 16"}]
[16] tlog: [1731401062.256759594, {"log"=>"Append: 17"}]
[17] tlog: [1731401062.261444819, {"log"=>"Overwrite: 20"}]
[18] tlog: [1731401062.261447270, {"log"=>"Append: 21"}]
[19] tlog: [1731401062.261447682, {"log"=>"Append: 22"}]
[20] tlog: [1731401062.261448116, {"log"=>"Append: 23"}]
[21] tlog: [1731401062.261448512, {"log"=>"Append: 24"}]
[22] tlog: [1731401062.261449004, {"log"=>"Append: 25"}]
[23] tlog: [1731401062.261599735, {"log"=>"Overwrite: 30"}]
[24] tlog: [1731401062.261600563, {"log"=>"Append: 31"}]
[25] tlog: [1731401062.261601020, {"log"=>"Append: 32"}]
[26] tlog: [1731401062.261601472, {"log"=>"Append: 33"}]
[27] tlog: [1731401062.261640819, {"log"=>"Append: 34"}]
[28] tlog: [1731401062.261641251, {"log"=>"Append: 35"}]
[29] tlog: [1731401062.261687548, {"log"=>"Append: 36"}]
[30] tlog: [1731401062.261687972, {"log"=>"Append: 37"}]
[31] tlog: [1731401062.261688422, {"log"=>"Append: 38"}]
[32] tlog: [1731401062.261766004, {"log"=>"Overwrite: 40"}]
[33] tlog: [1731401062.261766439, {"log"=>"Append: 41"}]
[34] tlog: [1731401062.261802793, {"log"=>"Append: 42"}]
[35] tlog: [1731401062.261803225, {"log"=>"Append: 43"}]
[36] tlog: [1731401062.261848015, {"log"=>"Append: 44"}]
[37] tlog: [1731401062.261848442, {"log"=>"Append: 45"}]
[38] tlog: [1731401062.261891502, {"log"=>"Append: 46"}]
[39] tlog: [1731401062.261891934, {"log"=>"Append: 47"}]
[40] tlog: [1731401062.261892390, {"log"=>"Append: 48"}]
[41] tlog: [1731401062.261926407, {"log"=>"Append: 49"}]
[42] tlog: [1731401062.262008508, {"log"=>"Overwrite: 50"}]

Your Environment

  • Version used: amazon/aws-for-fluent-bit:2.10.0
  • Configuration:
/fluent-bit/etc/fluent-bit.conf

[SERVICE]
	Flush 1
[INPUT]
	Name tail
	Path /test
	Tag tlog
[OUTPUT]
	Name stdout
	Match tlog
  • Environment name and version (e.g. Kubernetes? What version?):
  • Server type and version: Local docker run.
  • Operating System and version: Ubuntu 22.0.4
  • Filters and plugins: Tail (Input plugin)

Additional context

@patrick-stephens
Copy link
Contributor

Please use the latest OSS version - you're using the AWS version which is a custom build of 1.9 series.

@myabcc17
Copy link
Author

myabcc17 commented Nov 13, 2024

Please use the latest OSS version - you're using the AWS version which is a custom build of 1.9 series.

@patrick-stephens
Same issue occurred in fluent/fluent-bit:latest image. It has 3.1.10 version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants