添加配置文件
cat /etc/logrotate.d/myservice /data/log/myservice/*.log { rotate 7 daily dateext dateformat .%Y%m%d compress missingok notifempty sharedscripts postrotate /usr/bin/killall -HUP rsyslogd >/dev/null 2>&1 || true endscript }
debug 配置文件是否正确,但不会真正动你的 log
logrotate -d /etc/logrotate.d/myservice
真实测试 logrotate 情况
logrotate -f /etc/logrotate.d/myservice
Leave a Reply