LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This 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


Reply
  Search this Thread
Old 10-16-2006, 01:25 PM   #1
OpenMacNews
LQ Newbie
 
Registered: Oct 2004
Posts: 10

Rep: Reputation: 0
logrotate ignoring 'size' spec ... why?


Code:
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
 
Old 10-16-2006, 01:58 PM   #2
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
Quote:
% 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.
 
Old 10-16-2006, 02:47 PM   #3
OpenMacNews
LQ Newbie
 
Registered: Oct 2004
Posts: 10

Original Poster
Rep: Reputation: 0
hi bigrigdriver,

Quote:
Originally Posted by bigrigdriver
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?

cheers,

richard
 
Old 10-16-2006, 07:35 PM   #4
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
From the logrotate man pages:

Quote:
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.
 
Old 10-16-2006, 07:50 PM   #5
OpenMacNews
LQ Newbie
 
Registered: Oct 2004
Posts: 10

Original Poster
Rep: Reputation: 0
hi again,

Quote:
Originally Posted by bigrigdriver
That's just vague enough
hehe! accident? i don't THINK so! :-p

Quote:
Originally Posted by bigrigdriver
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.

cheers,

richard
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Logrotate based on time AND size shishya Linux - Software 1 04-11-2006 07:30 PM
Ignoring difference of { and } anandss2004 Programming 7 11-01-2005 07:11 PM
ignoring dependencies ergo_sum Linux - Newbie 1 04-03-2005 06:05 PM
Huh? -- logrotate ignoring because of ~ ending JohnnyNemo Linux - Newbie 1 02-26-2004 08:34 PM
ignoring drive Y: Johng Linux - Software 2 12-14-2003 02:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:47 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration