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

Log rotation #6888

Closed
SimonMcN opened this issue Jan 10, 2020 · 4 comments
Closed

Log rotation #6888

SimonMcN opened this issue Jan 10, 2020 · 4 comments
Labels
area/logging bug unexpected problem or unintended behavior

Comments

@SimonMcN
Copy link

Hi, This is more of a question than a bug. I think it's a bug but probably a question of perspective. Your input would be appreciated.

Relevant telegraf.conf:
logfile_rotation_interval = "1d"
logfile_rotation_max_size = "10MB"

Expected behavior:
Logfile would be rotated in the following situations:
:1 day has elapsed since the file has been modified
:logfile is over 10MB

Actual behavior:
-Logfile grows until 10MB

Cheers
Simon

@SimonMcN
Copy link
Author

similar to #6183

@danielnelson
Copy link
Contributor

This should work like you expect, the first of the two conditions should trigger the rotation, though we still only rotate when the log file is written to as found in #6183.

Is this also due to no writes to the log file, like in #6183, or is the interval based log rotation not working at all?

@danielnelson danielnelson added area/logging bug unexpected problem or unintended behavior need more info labels Jan 14, 2020
@danielnelson
Copy link
Contributor

Closing but let me know if this is an issue distinct from #6183 and we'll reopen.

@donalod
Copy link

donalod commented Apr 19, 2021

This is still the case with Telegraf 1.17.2 on OSX. The logfile is currently 3 MB, constantly being written to, and is five days old but only 1 file exists still. The time dimension is not being honored.

  logfile_rotation_interval = "1d"
  logfile_rotation_max_size = "10MB"
  logfile_rotation_max_archives = 7

$ du -h telegraf.log
3.0M telegraf.log

$ GetFileInfo -d telegraf.log
04/14/2021 14:28:44

$ date
Mon 19 Apr 2021 22:55:17 IST

$ ls -al
total 6216
drwxr-xr-x 6 laptop staff 192 14 Apr 14:28 .
drwx------+ 18 laptop staff 576 19 Apr 21:22 ..
-rw------- 1 laptop staff 2392858 19 Apr 22:55 telegraf.log

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/logging bug unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants