severity 460542 minor
tags 460542 wontfix
thanks
On Sun, Jan 13, 2008 at 01:59:24PM +0000, Aaron Swartz wrote:
> I woke up this morning to find my webserver (lighttpd) unresponsive and
> logrotate using up 100% CPU. When I ran strace on logrotate I found:
>
> rename("/service/lighttpd/logs/error.log.638155266.gz",
> "/service/lighttpd/logs/error.log.638155267.gz") = -1 ENOENT (No such file or
> directory)
> rename("/service/lighttpd/logs/error.log.638155265.gz",
> "/service/lighttpd/logs/error.log.638155266.gz") = -1 ENOENT (No such file or
> directory)
> rename("/service/lighttpd/logs/error.log.638155264.gz",
> "/service/lighttpd/logs/error.log.638155265.gz") = -1 ENOENT (No such file or
> directory)
> rename("/service/lighttpd/logs/error.log.638155263.gz",
> "/service/lighttpd/logs/error.log.638155264.gz") = -1 ENOENT (No such file or
> directory)
> rename("/service/lighttpd/logs/error.log.638155262.gz",
> "/service/lighttpd/logs/error.log.638155263.gz") = -1 ENOENT (No such file or
> directory)
> rename("/service/lighttpd/logs/error.log.638155261.gz",
> "/service/lighttpd/logs/error.log.638155262.gz") = -1 ENOENT (No such file or
> directory)
> rename("/service/lighttpd/logs/error.log.638155260.gz",
> "/service/lighttpd/logs/error.log.638155261.gz") = -1 ENOENT (No such file or
> directory)
> rename("/service/lighttpd/logs/error.log.638155259.gz",
> "/service/lighttpd/logs/error.log.638155260.gz") = -1 ENOENT (No such file or
> directory)
> rename("/service/lighttpd/logs/error.log.638155258.gz",
> "/service/lighttpd/logs/error.log.638155259.gz") = -1 ENOENT (No such file or
> directory)
> /service/lighttpd/logs/*.log {
> weekly
> missingok
> copytruncate
> rotate 999999999
That line is your problem, and here is the loop that runs based on that
value:
for (i = rotateCount + logStart - 1; (i >= 0) && !hasErrors; i--) {
tmp = newName;
newName = oldName;
oldName = tmp;
sprintf(oldName, "%s/%s.%d%s%s", dirName, baseName, i,
fileext, compext);
message(MESS_DEBUG, "renaming %s to %s (rotatecount %d, logstart %d, i
%d), \n", oldName, newName,
rotateCount, logStart, i);
if (!debug && rename(oldName, newName)) {
if (errno == ENOENT) {
message(MESS_DEBUG, "old log %s does not exist\n",
oldName);
} else {
message(MESS_ERROR, "error renaming %s to %s: %s\n",
oldName, newName, strerror(errno));
hasErrors = 1;
}
}
}
Might I suggest you use dateext instead, as that avoids all the renames?
eg:
rotate 999999999
dateext
PS. 999999999 days is 2.7 million years.
--
Paul Martin <[EMAIL PROTECTED]>
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]