Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
hi,
i've built and installed LOGROTATE v3.7.4-7 from a src tarball, extracted via rpm2cpio from:
http://download.fedora.redhat.com/pub/fedora/linux/core/development/source/SRPMS/logrotate-3.7.4-7.src.rpm
my lograte.conf includes:
====================================
compresscmd /usr/bin/gzip
uncompresscmd /usr/bin/gunzip
/var/log/test.log {
size 3M
daily
maxage 30
rotate 30
create 640 devuser devgrp
dateext
missingok
notifempty
sharedscripts
postrotate
kill -HUP `cat /var/process/exim/exim.pid 2>/dev/null` 2> /dev/null || true
endscript
nomail
nocompress
}
====================================
currently, test.log is > 3M in size:
% ls -al /var/log/test.log
-rw-r----- 1 devuser devgrp 22782552 Oct 16 10:20 test.log
my GOAL, with the above conf, is to exec logrotate hourly, via a cronjob and have it rotate test.log 'only' once daily, UNLESS the log files has exceeded 3M, then rotate immediately ...
but, when i exec logrotate, i get:
"empty log files are not rotated, only log files >= 3145728 bytes are rotated, old logs are removed.
considering log /var/log/test.log.
log does not need rotating"
and, test.log is NOT rotated.
what am i config'ing wrong here?
thanks,
richard
% ls -al /var/log/test.log
-rw-r----- 1 devuser devgrp 22782552 Oct 16 10:20 test.log
It does not appear that you are doing anything wrong. Either the log will rotate when the size exceeds 3M (which it has not done), or it will rotate at the end of the day (which has not yet occured).
Look at the file size and time stamp on the output of your 'ls -al' command.
It does not appear that you are doing anything wrong. Either the log will rotate when the size exceeds 3M (which it has not done), or it will rotate at the end of the day (which has not yet occured).
Code:
argh! bits-n-bytes ...
ok, so file_sz(22784640) = 2.72 M
fair point.
changing to:
% grep size logrotate.conf
size 1M
where "22784640" _is_ > 1M,
on execute of logrotate, i *still* get:
"empty log files are not rotated, only log files >= 1048576
bytes are rotated, old logs are removed considering log
/var/log/test.log
log does not need rotating"
Quote:
Look at the file size and time stamp on the output of your 'ls -al' command.
that's clear -- but should be (?) irrelevant, as 'size' spec is *supposed* to override 'daily' .... no?
Normally, logrotate is run as a daily cron job. It will not modify a log multiple
times in one day unless the criterium for that log is based on the log's size and
logrotate is being run multiple times each day, or unless the -f or -force option
is used.
That's just vague enough to have me wondering if size and daily are mutually exclusive for proper operation of logrotate. Which has priority over the other? Normally, it's run as a daily rotation. If size is specified and daily is also specified, will size spec work? I don't know.
In your case, obviously it isn't working. Try re-ordering the specs. Put size somewhere after daily, then try again. Or, remove the daily spec to see if it works with a size spec.
Last edited by bigrigdriver; 10-16-2006 at 07:37 PM.
to have me wondering if size and daily are mutually exclusive for proper operation of logrotate. Which has priority over the other? Normally, it's run as a daily rotation. If size is specified and daily is also specified, will size spec work? I don't know.
In your case, obviously it isn't working. Try re-ordering the specs. Put size somewhere after daily, then try again. Or, remove the daily spec to see if it works with a size spec.
so far, no effect as a result of reordering.
REMOING the "daily" spec, DOES get the "size" spec working as expected -- but of source, one loses the once-per-day capability.
and, of course, 'daily' without 'size' works too.
all that said, my workaround for the moment is TWO cron jobs, with two different .conf files. One, running once a day, with a "daily" spec, and one running, say, hourly, with a "size" spec.
not optimal, and certainly NOT the wasy one would hope presume it works, but oh well.
i've been looking around for better-behaved, well-supported rotate progs/scripts .. haven't found one (yet). thinking of simply (well, not exactly ...) writing my own.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.