Hello. Sorry if this is too simple a question. How do I go about automatically purging logs of an application in production? The application runs on a Windows server. Thanks. Pepe --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
$ rake -T log (in /Users/philip/Work/Careers.org/web/trunk) rake log:clear # Truncates all *.log files in log/ to zero bytes Whether or not you need to restart any services after that depends on your setup. -philip On Jul 16, 2008, at 9:36 AM, pepe wrote:> > Hello. > > Sorry if this is too simple a question. How do I go about > automatically purging logs of an application in production? The > application runs on a Windows server. > > Thanks. > > Pepe > >--~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
I''m sorry but I am not very familiar with rake and I don''t understand your posting. Doesn''t the $ in your command mean that it is run manually? What I need is for the application/server to take care of the logs itself and delete log information older than, for example, x amount of days. Also, why would I need to restart services if I am just deleting data from a text file such as ''production.log'' or ''server.log''? Would the files need to be locked to purge them? Thanks Pepe On Jul 16, 12:43 pm, Philip Hallstrom <phi...-LSG90OXdqQE@public.gmane.org> wrote:> $ rake -T log > (in /Users/philip/Work/Careers.org/web/trunk) > rake log:clear # Truncates all *.log files in log/ to zero bytes > > Whether or not you need to restart any services after that depends on > your setup. > > -philip > > On Jul 16, 2008, at 9:36 AM, pepe wrote: > > > > > Hello. > > > Sorry if this is too simple a question. How do I go about > > automatically purging logs of an application in production? The > > application runs on a Windows server. > > > Thanks. > > > Pepe--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Jul 16, 2008, at 9:54 AM, pepe wrote:> > I''m sorry but I am not very familiar with rake and I don''t understand > your posting. > > Doesn''t the $ in your command mean that it is run manually?Yes, but you could also run that via cron to make it automatic.> What I > need is for the application/server to take care of the logs itself and > delete log information older than, for example, x amount of days.To do that you need to configure one of the other logging mechanism''s to split the logs up by day and automatically purge them. Google around for plugins to do this (if it isn''t already built in to rails, i don''t remember)> Also, why would I need to restart services if I am just deleting data > from a text file such as ''production.log'' or ''server.log''? Would the > files need to be locked to purge them?If another process has a file open when you remove it, the OS doesn''t really remove it until that first process closes the file. Which if it''s a web server, it may never do. So you think you''ve removed it, but it will keep increasing in size. -philip> Thanks > > Pepe > > On Jul 16, 12:43 pm, Philip Hallstrom <phi...-LSG90OXdqQE@public.gmane.org> wrote: >> $ rake -T log >> (in /Users/philip/Work/Careers.org/web/trunk) >> rake log:clear # Truncates all *.log files in log/ to zero bytes >> >> Whether or not you need to restart any services after that depends on >> your setup. >> >> -philip >> >> On Jul 16, 2008, at 9:36 AM, pepe wrote: >> >> >> >>> Hello. >> >>> Sorry if this is too simple a question. How do I go about >>> automatically purging logs of an application in production? The >>> application runs on a Windows server. >> >>> Thanks. >> >>> Pepe > >--~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks! Pepe On Jul 16, 2:15 pm, Philip Hallstrom <phi...-LSG90OXdqQE@public.gmane.org> wrote:> On Jul 16, 2008, at 9:54 AM, pepe wrote: > > > > > I''m sorry but I am not very familiar with rake and I don''t understand > > your posting. > > > Doesn''t the $ in your command mean that it is run manually? > > Yes, but you could also run that via cron to make it automatic. > > > What I > > need is for the application/server to take care of the logs itself and > > delete log information older than, for example, x amount of days. > > To do that you need to configure one of the other logging mechanism''s > to split the logs up by day and automatically purge them. Google > around for plugins to do this (if it isn''t already built in to rails, > i don''t remember) > > > Also, why would I need to restart services if I am just deleting data > > from a text file such as ''production.log'' or ''server.log''? Would the > > files need to be locked to purge them? > > If another process has a file open when you remove it, the OS doesn''t > really remove it until that first process closes the file. Which if > it''s a web server, it may never do. So you think you''ve removed it, > but it will keep increasing in size. > > -philip > > > Thanks > > > Pepe > > > On Jul 16, 12:43 pm, Philip Hallstrom <phi...-LSG90OXdqQE@public.gmane.org> wrote: > >> $ rake -T log > >> (in /Users/philip/Work/Careers.org/web/trunk) > >> rake log:clear # Truncates all *.log files in log/ to zero bytes > > >> Whether or not you need to restart any services after that depends on > >> your setup. > > >> -philip > > >> On Jul 16, 2008, at 9:36 AM, pepe wrote: > > >>> Hello. > > >>> Sorry if this is too simple a question. How do I go about > >>> automatically purging logs of an application in production? The > >>> application runs on a Windows server. > > >>> Thanks. > > >>> Pepe--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 16 Jul 2008, at 20:15, Philip Hallstrom wrote:>> What I >> need is for the application/server to take care of the logs itself >> and >> delete log information older than, for example, x amount of days. > > To do that you need to configure one of the other logging mechanism''s > to split the logs up by day and automatically purge them. Google > around for plugins to do this (if it isn''t already built in to rails, > i don''t remember)That magic mechanism is called logrotate and it''s built into any Unix/ Linux based system. In /etc/logrotate.d/, create a new file (you can name it whatever you want, the app name for example), then put this in it: /path/to/your/railsapp/shared/log/production.log { copytruncate daily missingok rotate 14 compress delaycompress } There should already be a crontab that fires it every day, since that''s what your Linux does to rotate its own logs. And strangle enough, that information could be found on http://wiki.rubyonrails.org/rails/pages/DeploymentTips ;-) Best regards Peter De Berdt --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---