代码拉取完成,页面将自动刷新
HOME > EN > Log Rotate
SRS always writes log to a single log file srs.log
, so it will become very larger. We can use rotate the log to zip or remove it.
mv objs/srs.log /tmp/srs.`date +%s`.log
killall -s SIGUSR1
Recommend to use logrotate to manage log files.
sudo yum install -y logrotate
cat << END > /etc/logrotate.d/srs
/usr/local/srs/objs/srs.log {
daily
dateext
compress
rotate 7
size 1024M
sharedscripts
postrotate
kill -USR1 \`cat /usr/local/srs/objs/srs.pid\`
endscript
}
END
Note: Run logrotate manually by
logrotate -f /etc/logrotate.d/srs
For SRS2, we could use copytruncate, but it's strongly not recommended because the logs maybe dropped, so it's only a workaround for server not supported SIGUSR1 such as SRS2.
Yes, SRS3 surely supports copytruncate and it's not recommended.
The config is bellow, from PR#1561 by wnpllrzodiac:
cat << END > /etc/logrotate.d/srs
/usr/local/srs/objs/srs.log {
daily
dateext
compress
rotate 7
size 1024M
copytruncate
}
END
Winlin 2016.12
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。