我将 logrotate 设置为在文件达到 5M 时旋转,但它忽略了它,如果我每天添加它将每天旋转而不管大小,我尝试使用 size、minsize 和 maxsize 都是一样的,唯一的区别是“大小”它甚至没有提到它在输出中,这是我的配置和 logrotate -vdf /etc/logrotate.d/maillog 的输出
(运行以下测试时的实际日志文件大小为 45K)
(所有测试的 conf 文件都相同,只是更改了大小参数)
/var/log/maillog {
size 5M
rotate 50
create 644 root root
dateext
dateformat -%Y-%m-%d_%H_%s
notifempty
postrotate systemctl restart rsyslog
systemctl restart postfix
endscript }
Run Code Online (Sandbox Code Playgroud)
尺寸:
logrotate -vdf /etc/logrotate.d/maillog
reading config file /etc/logrotate.d/maillog
Allocating hash table for state file, size 15360 B
Handling 1 logs
rotating pattern: /var/log/maillog forced from command line (50 rotations)
empty log files are not rotated, …Run Code Online (Sandbox Code Playgroud) logrotate ×1