From 1592aaff89cc21a286c27bc958a63fbecfe469f5 Mon Sep 17 00:00:00 2001 From: "Matt K. Fu" Date: Thu, 4 Jul 2013 12:28:11 +0800 Subject: [PATCH] add option to logrotate for conversional policy. --- lib/tasks/site.rake | 1 + lib/template/setting/rulingcom_log.erb | 20 ++++++++++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/lib/tasks/site.rake b/lib/tasks/site.rake index 2ccf22498..a63f4394c 100644 --- a/lib/tasks/site.rake +++ b/lib/tasks/site.rake @@ -93,6 +93,7 @@ def create_rulingcom_logrotate File.open("#{@project_loc}/tmp/logrotate_setting", 'w') { |file| file.write(logrotate_setting.result) } `sudo cp #{@project_loc}/tmp/logrotate_setting /etc/logrotate.d/rulingcom` + `logrotate -v -f /etc/logrotate.conf` end end diff --git a/lib/template/setting/rulingcom_log.erb b/lib/template/setting/rulingcom_log.erb index 15bfdea17..44f104cb0 100644 --- a/lib/template/setting/rulingcom_log.erb +++ b/lib/template/setting/rulingcom_log.erb @@ -1,24 +1,32 @@ /var/log/rulingcom/*.log { daily - rotate 5 + dateext + compress + rotate 30 } #Resque <%= "#{@project_folder}/nginx/logs/access.log" %>{ - daily - rotate 5 + daily + dateext + compress + rotate 30 } #DB log /var/log/mongodb{ daily - rotate 5 + dateext + compress + rotate 30 } #Orbit <%= "#{@project_folder}/log/*production.log" %>{ - daily - rotate 5 + daily + dateext + compress + rotate 30 } # end of Orbit,EXTEND IF NEEDED