用户工具

站点工具


jaysnote:logrotate

logrotate

docs

  • man logrotate

troubleshootings

日志异常

如上强制logrotate ,执行以下步骤。

logrotate -v -f /etc/logrotate.d/kernel-message 
  • 重命名当前日志

    renaming /var/log/messages to /var/log/messages-20180827
  • 压缩文件

    compressing log with: /bin/gzip

默认的文件已经不在了。

root@350-tf-s2 /var/log# ls -lhS message*
ls -lhS kern*
-rw-r----- 1 root adm 1.6M Aug 26 06:25 messages-20180826.gz
-rw-r----- 1 root adm 353K Aug 27 15:19 messages-20180827.gz
root@350-tf-s2 /var/log# ls -lhS kern*
-rw-r----- 1 root adm 1.5M Aug 26 06:25 kern.log-20180826.gz
-rw-r----- 1 root adm 334K Aug 27 15:17 kern.log-20180827.gz
jaysnote/logrotate.txt · 最后更改: 2018/11/12 16:43 由 jaylee