Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.
Original topic: log.file.max-backups 参数的作用范围
Today I encountered an interesting phenomenon. I always thought that the historical files of the slowlog would not have an automatic cleanup mechanism, but today I found that the historical files of the slowlog were all cleaned up. Then, I noticed that the log files under tidb-deploy/tidb-4000/log added up to 10, and I happened to set log.file.max-backups to 10. So, I am guessing whether the log.file.max-backups parameter is also effective for the slowlog. In other words, when this log.file.max-backups parameter takes effect, it will also delete the historical logs of the slowlog to meet the set value of the log.file.max-backups parameter. I wonder if anyone else has encountered this issue.
If you want to keep it, increase the threshold.
The information provided by the expert is very useful, but based on my observations, max-backups is effective for the historical slow log cleanup mechanism, while max-days does not seem to be very effective for historical slow log cleanup. When in the code will the max-backups and max-days parameters take effect?
Thank you for your reply.
In conjunction with the max-size
parameter, old slow logs are generated, and when the last modification time of the old slow logs reaches max-days
, the old slow logs will be cleaned up. max-days
and max-backups
are set to retain logs from two different dimensions.
Is the automatic log cleanup time determined by simultaneously meeting the values of max-days
and max-backups
?
Do the max-days and max-backups parameters apply to error logs, such as tidb_stderr.log, in this way?
By default, each node server outputs standard errors in the logs. If the --log-file
parameter is specified during startup, the logs will be output to the specified file and rotated daily.
It seems like this parameter also applies to error logs according to the documentation!
Is there a corresponding documentation link?
In general production, you should at least retain the data from the past week, right?
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.