logrotate日志轮转工具
验证logrotate
sudo logrotate -f /etc/logrotate.conferror: line 2 too long in state file /var/lib/logrotate.statusdebug logrotate
#!/bin/sh
/usr/sbin/logrotate /etc/logrotate.conf
EXITVALUE=$?
if [ $EXITVALUE != 0 ]; then
/usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]"
fi
exit $EXITVALUE注意:默认SELinux安全设置不允许logrotate轮转/var/log目录之外的文件
/var/log目录之外的文件诊断logrotate
参考
Last updated