版本:v0.2.36-63599fb5b7ce8fb3f9dd76d7a6b469e1cf738eaf
配置:
[log]
# file_name is the file to write logs to
file_name = "/data0/logs/categraf/categraf.log"
# options below will not be work when file_name is stdout or stderr
# max_size is the maximum size in megabytes of the log file before it gets rotated. It defaults to 100 megabytes.
max_size = 100
# max_age is the maximum number of days to retain old log files based on the timestamp encoded in their filename.
max_age = 2
# max_backups is the maximum number of old log files to retain.
max_backups = 10
# local_time determines if the time used for formatting the timestamps in backup files is the computer's local time.
local_time = true
# Compress determines if the rotated log files should be compressed using gzip.
compress = true
ll /data0/logs/categraf/ -ht
total 4.0K
-rw------- 1 root root 0 Apr 5 03:39 categraf.log
-rw------- 1 root root 912 Apr 4 15:09 categraf.log-20230405.gz
lsof |grep categraf.log
categraf 24353 root 3w REG 253,17 10433 19398661 /data0/logs/categraf/categraf.log-20230405 (deleted)
categraf 24353 20739 root 3w REG 253,17 10433 19398661 /data0/logs/categraf/categraf.log-20230405 (deleted)
categraf 24353 24354 root 3w REG 253,17 10433 19398661 /data0/logs/categraf/categraf.log-20230405 (deleted)
categraf 24353 24355 root 3w REG 253,17 10433 19398661 /data0/logs/categraf/categraf.log-20230405 (deleted)
categraf 24353 24356 root 3w REG 253,17 10433 19398661 /data0/logs/categraf/categraf.log-20230405 (deleted)
categraf 24353 24357 root 3w REG 253,17 10433 19398661 /data0/logs/categraf/categraf.log-20230405 (deleted)
categraf 24353 24359 root 3w REG 253,17 10433 19398661 /data0/logs/categraf/categraf.log-20230405 (deleted)
categraf 24353 24360 root 3w REG 253,17 10433 19398661 /data0/logs/categraf/categraf.log-20230405 (deleted)
categraf 24353 24361 root 3w REG 253,17 10433 19398661 /data0/logs/categraf/categraf.log-20230405 (deleted)
categraf 24353 24362 root 3w REG 253,17 10433 19398661 /data0/logs/categraf/categraf.log-20230405 (deleted)
categraf 24353 24363 root 3w REG 253,17 10433 19398661 /data0/logs/categraf/categraf.log-20230405 (deleted)
categraf 24353 24364 root 3w REG 253,17 10433 19398661 /data0/logs/categraf/categraf.log-20230405 (deleted)
categraf 24353 25322 root 3w REG 253,17 10433 19398661 /data0/logs/categraf/categraf.log-20230405 (deleted)
categraf 24353 25323 root 3w REG 253,17 10433 19398661 /data0/logs/categraf/categraf.log-20230405 (deleted)
为什么切割后,文件句柄没释放?手动重启下才行