I just woke up to some unhappy clients because their website was down. The log file was an obsurd size, so big that there was no more space left on the disk. Is it possible to turn logging off, or at least truncate it every night or something? Thanks for your help. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
If you are using some form of unix you could just use logwatch... same as for most logs on your system (apache, smtp, etc.) Take care, Sean On 9/3/06, Ben Johnson <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > I just woke up to some unhappy clients because their website was down. > The log file was an obsurd size, so big that there was no more space > left on the disk. > > Is it possible to turn logging off, or at least truncate it every night > or something? > > Thanks for your help. > > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
I typed this off the top of my head without testing so proceed carefully and make backups! Here''s a quick answer if it''s a unix system, make a script that does the following: DATE=`date +"%Y%m%d"` cp /PATH_TO_LOGS/production.log /PATH_TO_LOGS/production.log.$DATE cp /dev/null /PATH_TO_LOGS/production.log find /PATH_TO_LOGS -name "production.log.*" ! -name "*.gz" -mtime +7 -exec gzip {} \; find /PATH_TO_LOGS -name "production.log.*" -mtime +14 -exec rm {} \; This will copy the log to a datestamped file (you can copy to another dir if you want). Then it will null out the current log. Then it will compress any datestamped log older then a week. Then it will remove any datestamped log older then 14 days. You don''t have to remove it, you can move the file somewhere with more storage if you want with a line like this: find /PATH_TO_LOGS -name "production.log.*" -mtime +14 -exec mv {} /PATH_TO_ARCHIVE \; Put it in your crontab to run every night: 0 30 * * * /PATH_TO_SCRIPT/clean_logs.sh Try not to do it right at midnight. Other things may be happening at that moment. On 9/3/06, Ben Johnson <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > I just woke up to some unhappy clients because their website was down. > The log file was an obsurd size, so big that there was no more space > left on the disk. > > Is it possible to turn logging off, or at least truncate it every night > or something? > > Thanks for your help. > > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
> Ben wrote: > > I just woke up to some unhappy clients because their website was down. > The log file was an obsurd size, so big that there was no more space > left on the disk. > > Is it possible to turn logging off, or at least truncate it every night > or something? >How about using logrotate? You can control the size of the log file and have it backed up for N number of days. Long --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Ben Johnson wrote:> I just woke up to some unhappy clients because their website was down. > The log file was an obsurd size, so big that there was no more space > left on the disk. > > Is it possible to turn logging off, or at least truncate it every night > or something? > > Thanks for your help.Hi Ben, In config/environment.rb make sure that log_level = :info is set. You may also want to set up a cron job to rotate your logs nightly and delete or archive them out once they are x number of days/weeks old. Phil -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Does rails come with, or is there a plugin for, rotating logfiles? i.e. similar to log4j in the java world -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---