Re: [SLUG] logrotate hourly
On 100112 at 16:09, david wrote: Is there a good reason NOT to rotate logs hourly.. for example by moving the logrotate cron to hourly instead of daily? This is a file created hourly by cron for which I want to keep a history. Maybe you rather want to include the date in the file name, so it is not overwritten. E.g., for an arbitrary cronjob named foobar: foobar /var/log/foobar.log.$(date +%w) 21 This will keep the 6 last files. You get the idea. logrotate looks like a good way to do it. I'm assuming there is no hourly option in logrotate, so I was going to force it to rotate by specifying a very small file size. If you do the above, logrotate should ignore the file. /steffen -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
Re: [SLUG] logrotate hourly
Upon re-reading the question, I just realised that you create the file hourly from cron. You can then either follow Steffens' advise or run savelog or your own mv (since Savelog is limited in its file naming options) at the end of the cron job. On 1/13/10, Steffen Schulz pepe...@gmx.net wrote: On 100112 at 16:09, david wrote: Is there a good reason NOT to rotate logs hourly.. for example by moving the logrotate cron to hourly instead of daily? This is a file created hourly by cron for which I want to keep a history. Maybe you rather want to include the date in the file name, so it is not overwritten. E.g., for an arbitrary cronjob named foobar: foobar /var/log/foobar.log.$(date +%w) 21 This will keep the 6 last files. You get the idea. logrotate looks like a good way to do it. I'm assuming there is no hourly option in logrotate, so I was going to force it to rotate by specifying a very small file size. If you do the above, logrotate should ignore the file. /steffen -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
Re: [SLUG] logrotate hourly
Amos Shapira wrote: Upon re-reading the question, I just realised that you create the file hourly from cron. You can then either follow Steffens' advise or run savelog or your own mv (since Savelog is limited in its file naming options) at the end of the cron job. On 1/13/10, Steffen Schulz pepe...@gmx.net wrote: On 100112 at 16:09, david wrote: Is there a good reason NOT to rotate logs hourly.. for example by moving the logrotate cron to hourly instead of daily? This is a file created hourly by cron for which I want to keep a history. Maybe you rather want to include the date in the file name, so it is not overwritten. E.g., for an arbitrary cronjob named foobar: foobar /var/log/foobar.log.$(date +%w) 21 This will keep the 6 last files. You get the idea. logrotate looks like a good way to do it. I'm assuming there is no hourly option in logrotate, so I was going to force it to rotate by specifying a very small file size. If you do the above, logrotate should ignore the file. Ultimately I realised I was being too complicated. I added the following line to the cron job that creates the file. Each file is uniquely named with a date stamp as part of the cron script. This line should keep one week's worth of files. find $DIRECTORY/ -name *.tar -type f -mmin +10080 -delete thanks everyone... David. -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
[SLUG] logrotate hourly
Is there a good reason NOT to rotate logs hourly.. for example by moving the logrotate cron to hourly instead of daily? This is a file created hourly by cron for which I want to keep a history. logrotate looks like a good way to do it. I'm assuming there is no hourly option in logrotate, so I was going to force it to rotate by specifying a very small file size. Or is there a better way (tm). -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
Re: [SLUG] logrotate hourly
Depends on the impact of logrotation on the program for which the rotation is occurring. Also if there is low log activity, you may find a large number of otherwise empty files will become troublesome to deal with. Dean david wrote: Is there a good reason NOT to rotate logs hourly.. for example by moving the logrotate cron to hourly instead of daily? This is a file created hourly by cron for which I want to keep a history. logrotate looks like a good way to do it. I'm assuming there is no hourly option in logrotate, so I was going to force it to rotate by specifying a very small file size. Or is there a better way (tm). -- http://fragfest.com.au -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html