Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.
Original topic: tidb日志很大了怎么清理
[TiDB Usage Environment] Production Environment / Testing / PoC
[TiDB Version] 7.1
[Reproduction Path]
[Encountered Problem: Problem Phenomenon and Impact]
The tidb.log and slow logs under the tidb node have recently grown very large. I want to clean them up. Should I delete them directly or stop the tidb node service before deleting?
Keep the latest one, the old ones can be deleted directly.
There are parameters in the configuration file to configure the log retention time or retention quantity:
Thank you, so just set the parameters to enable automatic cleanup, right?
You can just delete it directly, classmate.
It’s best to back up before deleting in the production environment.
Just delete the most recent log errors.
You can set the retention days and the number of retained files.
Delete while retaining for seven days
log.file
Configuration items related to log files.
filename
- The name of the general log file.
- Default value: “”
- If set, general logs will be output to this file.
max-size
- The size limit of the log file.
- Default value: 300
- Unit: MB
- The maximum setting limit is 4096.
max-days
- The maximum number of days to retain logs.
- Default value: 0
- By default, logs are not cleaned; if a parameter value is set, TiDB will clean up expired log files after
max-days
.
max-backups
- The maximum number of log backups to retain.
- Default value: 0
- By default, all logs are saved; if set to 7, a maximum of 7 old log files will be retained.
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.