检查日志占用
du -sh /var/log/* | sort -rh | head -10 ls -lh /var/log/*.log
配置 Logrotate
cat > /etc/logrotate.d/custom << 'EOF'
/var/log/*.log {
daily
rotate 7
compress
delaycompress
missingok
notifempty
create 644 root root
}
EOF
手动执行
logrotate -f /etc/logrotate.conf logrotate -d /etc/logrotate.d/custom # 调试模式