RobinWu 发表于 2013-1-17 02:50:23

使用Linux的logrotate拆分rails的log

安装logrotate
sudo apt-get install logrotate

vim /etc/logrotate.conf/home/<user_name>/projects/<prj_name>/log/*.log {daily         #按日阶段missingokrotate 7      #保留7天compress      #压缩delaycompress #不压缩前一个(previous)截断的文件(需要与compress一起用)notifempty    #增加日期作为后缀,不然会是一串无意义的数字copytruncate#清空原有文件,而不是创建一个新文件}

强制执行logrotate
sudo /usr/sbin/logrotate -f /etc/logrotate.conf

<div class="quote_title">引用
页: [1]
查看完整版本: 使用Linux的logrotate拆分rails的log