Ruby on rails 如何制作日志旋转rails 3.2.8版本

Ruby on rails 如何制作日志旋转rails 3.2.8版本,ruby-on-rails,ruby-on-rails-3,logging,ruby-on-rails-3.2,Ruby On Rails,Ruby On Rails 3,Logging,Ruby On Rails 3.2,如何在rails版本3.2.8的生产环境中进行日志循环 我已经看过了,但是是旧版本的rails 我使用nginx+unicorn 我在哪里可以找到更多关于这个的信息 多谢各位 这个shell脚本适合我。我设置了cron,让它每晚在午夜前执行这个脚本。您需要根据自己的应用程序调整目录。请注意,目录引用是相对于我的应用程序的根目录的。“kill”命令告诉unicorn主进程重新加载,这将自动创建一个新的production.log和unicorn.log文件 #!/bin/bash # Rotate

如何在rails版本3.2.8的生产环境中进行日志循环

我已经看过了,但是是旧版本的rails

我使用nginx+unicorn

我在哪里可以找到更多关于这个的信息


多谢各位

这个shell脚本适合我。我设置了cron,让它每晚在午夜前执行这个脚本。您需要根据自己的应用程序调整目录。请注意,目录引用是相对于我的应用程序的根目录的。“kill”命令告诉unicorn主进程重新加载,这将自动创建一个新的production.log和unicorn.log文件

#!/bin/bash
# Rotates unicorn.log and production.log files located
# in the <application_root>/log folder.
# Deletes compressed logs older than 60 days.
NOW=`date +%Y%m%d_%H%M%S`
cd /home/deployer/apps/stations/current
mv log/production.log log/production_$NOW.log
mv log/unicorn.log log/unicorn_$NOW.log
kill -s USR1 `cat tmp/pids/unicorn.pid`
sleep 1
gzip log/production_$NOW.log
gzip log/unicorn_$NOW.log
find log/ -type f -mtime +60 -name "*.gz" -delete
#/bin/bash
#旋转位于的unicorn.log和production.log文件
#在/log文件夹中。
#删除超过60天的压缩日志。
NOW=`date+%Y%m%d\u%H%m%S`
cd/home/deployer/apps/stations/current
mv log/production.log/production\uu$NOW.log
mv log/unicorn.log/unicorn_uu$NOW.log
kill-s USR1`cat tmp/pids/unicorn.pid`
睡眠1
gzip log/production_u$NOW.log
gzip log/unicorn_u$NOW.log
查找日志/-类型f-mtime+60-名称“*.gz”-删除

nginx和unicorn都应该响应USR1进行日志轮换这在过去对我有帮助: