Skip to content

v3_EN_LogRotate

winlin edited this page Oct 7, 2019 · 17 revisions

HOME > EN(3.0) > Log Rotate

LogRotate

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.

  1. First, move the log file to another tmp log file:
mv objs/srs.log /tmp/srs.`date +%s`.log
  1. Then, send signal to SRS. SRS will close the previous file fd and reopen the log file:
killall -s SIGUSR1
  1. Finally, zip or remove the tmp log file.

Use logrotate

Recommend to use logrotate to manage log files.

  1. Install logrotate:
sudo yum install -y logrotate
  1. Config logrotate to manage SRS log file:
cat << END > /etc/logrotate.d/srs
/usr/local/srs/objs/srs.log {
    daily
    dateext
    compress
    rotate 7
    sharedscripts
    postrotate
        kill -USR1 `cat /usr/local/srs/objs/srs.pid`
    endscript
}
END

Note: Run logrotate manually by logrotate -f /etc/logrotate.d/srs

Winlin 2016.12

Welcome to SRS wiki!

SRS 5.0 wiki

Please select your language:

SRS 4.0 wiki

Please select your language:

SRS 3.0 wiki

Please select your language:

SRS 2.0 wiki

Please select your language:

SRS 1.0 wiki

Please select your language:

Clone this wiki locally