Hi guys, Logrotate is checked every day by cron.daily, right? I notice in logrotate.conf by default it's weekly. If I change it into monthly (now, on 12 of Feb), when will it do the monthly rotation? a. On 12 of March or b. On 1st of March?
Thanks for any insight.
On Thu, Feb 12, 2009 at 11:05 AM, Fajar Priyanto fajarpri@arinet.org wrote:
Hi guys, Logrotate is checked every day by cron.daily, right? I notice in logrotate.conf by default it's weekly. If I change it into monthly (now, on 12 of Feb), when will it do the monthly rotation?
AFAIK it is a default value to rotate the log file which could be override by individual configuration on /etc/logrotate.d/ so if it the individual configuration doesn't specify the rotation period it will use the default which is weekly
a. On 12 of March or b. On 1st of March?
weekly use monday so I think it will be 1st of march. CMIIW regards,
On Thu, Feb 12, 2009 at 12:12 PM, muhammad panji sumodirjo@gmail.com wrote:
On Thu, Feb 12, 2009 at 11:05 AM, Fajar Priyanto fajarpri@arinet.org wrote:
Hi guys, Logrotate is checked every day by cron.daily, right? I notice in logrotate.conf by default it's weekly. If I change it into monthly (now, on 12 of Feb), when will it do the monthly rotation?
AFAIK it is a default value to rotate the log file which could be override by individual configuration on /etc/logrotate.d/ so if it the individual configuration doesn't specify the rotation period it will use the default which is weekly
My question is changing weekly to monthly.
Anyway, after googling2, I found this very good indepth article on logrotate, thought I share it here: http://www.softpanorama.org/Logs/Log_rotation/logrotate.shtml One item that you didn't cover, is how logrotate knows when it is the proper time to rotate a daily, weekly, or monthly file. Part of that is controlled by the status file (/var/lib/logrotate.status on most Linux system) which tracks when a particular file was last rotated. The other part is that Monthly rotations are done with the first run of logrotate that month, and Weekly's are run if the last run was later in the previous week, or the last rotation was over 7 days prior (Sunday=0 Saturday=6). So if you are running logrotate daily, then it works itself out to the first day of the month, and Sunday's for the weeklies. So, it will be March 1st.
On Thu, Feb 12, 2009 at 01:08:24PM +0800, Fajar Priyanto wrote:
Hi Fajar, re logrotate and crontab: I was speaking from instinct knowing that crontab and a simple script to do the actual rotation is all that is needed. What I didn't expect was that someone had actually reinvented all the functionality of crontab to create a totally new utility that is much more limited than crontab.
Unfortunately, logrotate is, as implied by your earlier post, a totally separate tool when all that was needed was a small script invoked by cron. My apologies for my earlier post.
Also my apologies to you on behalf of the Linux community for the perpetration of such waste and bloat.
Sadly, that trend is rising, not fading.
Ironically Windows is currently trying to reduce the footprint of their basic package so it will fit better on netbooks. Perhaps we can follow in their footsteps. :-)
Jeff Kinz
On 2009-02-12 15:47, jkinz@kinz.org wrote:
On Thu, Feb 12, 2009 at 01:08:24PM +0800, Fajar Priyanto wrote:
Hi Fajar, re logrotate and crontab: I was speaking from instinct knowing that crontab and a simple script to do the actual rotation is all that is needed. What I didn't expect was that someone had actually reinvented all the functionality of crontab to create a totally new utility that is much more limited than crontab.
You mean "anacron"? Then you must read the man page again. It is intended to be used on those circumstances where cron would not work. E.g. on computers that are not always on, like most laptops. In that case cron would never run the logrotate script scheduled at 4 am in the morning. And, in fact anacron is not really bloated either, rather small, I would say.
Unfortunately, logrotate is, as implied by your earlier post, a totally separate tool when all that was needed was a small script invoked by cron. My apologies for my earlier post.
logrotate still is that simple script to be invoked by (ana)cron.
On Thu, Feb 12, 2009 at 04:12:07PM +0100, Paul Bijnens wrote:
On 2009-02-12 15:47, jkinz@kinz.org wrote:
On Thu, Feb 12, 2009 at 01:08:24PM +0800, Fajar Priyanto wrote:
Hi Fajar, re logrotate and crontab: I was speaking from instinct knowing that crontab and a simple script to do the actual rotation is all that is needed. What I didn't expect was that someone had actually reinvented all the functionality of crontab to create a totally new utility that is much more limited than crontab.
You mean "anacron"? Then you must read the man page again.
No, I mean logrotate.
logrotate still is that simple script to be invoked by (ana)cron.
No, logrotate is not a script.(It should be.)
Instead it is a complete stand alone utility written in C. In the version I just built from source, the executable is 65K bytes in size. It recreates most of what cron does internally to see if it needs to actually do anything during its once daily invocation. It is well written but I think the decision to create it was a flawed one, re-inventing the wheel where a script would have been OK. Even a script that allowed the same functionality as logrotate except for the parts done by cron would be fine.
On Centos/RHEL: (4.4) # file $(which logrotate) /usr/sbin/logrotate: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.2.5, dynamically linked (uses shared libs), stripped
On that "other" user friendly distro.... :-) (LTS 6.06) # file $(which logrotate) /usr/sbin/logrotate: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.2.0, dynamically linked (uses shared libs), for GNU/Linux 2.2.0, stripped
On Thu, Feb 12, 2009 at 12:05:09PM +0800, Fajar Priyanto wrote:
Logrotate is checked every day by cron.daily, right? I notice in logrotate.conf by default it's weekly. If I change it into monthly (now, on 12 of Feb), when will it do the monthly rotation? a. On 12 of March or b. On 1st of March?
Fajar - logrotate is driven by cron. Cron is one of UNIX (oops, I mean Linux) very important system utilities.
You need to know know about this, so check the man pages for cron and crontab to understand not only the timing on logrotate but on how ALL automated-scheduling of job/utilities are arranged on Linux.
Everything you need to know about how to schedule anything is in there.
Jeff Kinz