
我不確定為什麼這個特定文件沒有被輪換。它不是一個目錄。有任何想法嗎?
防火牆檔案的大小:
$ ls -alh /var/log
-rw-r--r--. 1 root root 134M Jan 31 13:49 firewalld
/etc/logrotate.conf 中的相關節:
/var/log/firewalld {
hourly
copytruncate
maxsize 1M
missingok
rotate 8
compress
notifempty
nomail
noolddir
}
執行的命令:
$ sudo logrotate -fv /etc/logrotate.conf
rotating pattern: /var/log/firewalld forced from command line (8 rotations)
empty log files are not rotated, log files >= 1048576 are rotated earlier, old logs are removed
No logs found. Rotation not needed.
set default create context
防火牆檔案的最終大小:
$ ls -alh /var/log
-rw-r--r--. 1 root root 134M Jan 31 13:49 firewalld
答案1
我在這篇文章中找到了答案:https://stackoverflow.com/posts/43398163/timeline
顯然 -v 開關與 -n 開關相同;換句話說,v-switch 實際上不會允許 logrotate 輪換日誌。