最近我更改了 LetsEncrypt 的日志配置,因为没有给定的日志配置,并且我有文件:
letsencrypt.log
letsencrypt.log.1
letsencrypt.log.10
letsencrypt.log.10.gz
letsencrypt.log.11
letsencrypt.log.11.gz
letsencrypt.log.12
letsencrypt.log.12.gz
letsencrypt.log.13
letsencrypt.log.13.gz
letsencrypt.log.14
letsencrypt.log.14.gz
letsencrypt.log.15
letsencrypt.log.15.gz
letsencrypt.log.16
letsencrypt.log.16.gz
其中偶数文件有 1409 字节,奇数文件有 0 字节。然而,Gzip 压缩的文件有一些内容(不同)。日志轮转的配置是:
/var/log/letsencrypt/*.log {
daily
rotate 32
compress
delaycompress
missingok
notifempty
create 644 root root
}
我应该如何更改日志轮换配置以仅保留:
- 前两个文件未压缩,
- 其余文件已压缩,
- 摆脱空文件?
答案1
好的,我已经成功地进行了正确的日志轮换:
/var/log/letsencrypt/*.log {
weekly
rotate 9
compress
delaycompress
missingok
create 644 root root
}
所以区别在于我已经删除了notifempty
.