Is there a log file size limit?

Tony Arnold tony.arnold at manchester.ac.uk
Fri Sep 1 10:04:14 UTC 2006


Damien,On Thu, 2006-08-31 at 18:19 -0800, Damien Hull wrote:
> I've been trying to figure out why /var/log/mail.log rotates when it 
> wants to. It should be once a week but it happens mid week. Someone told 
> me to look for a size limit in a config file. I couldn't find one. 
> However, /var/log/mail.log seems to rotate at about 1.1 megabytes. It 
> also rotates once a week. That's why things looked strange. I had a 
> small file after the weekly rotation and then a large one at 1.1 megabytes.
> 
> There must be a config file somewhere that sets the size limit on log 
> files. Can someone tell me where this is or where I should look?

I think I have figured it out.

There is a script in cron.daily and also in cron.weekloy called
sysklogd. This script is responsible for rotating log files, include
mail.log. Thus the log files are examined for possible rotation on a
daily and weekly basis.

To find out which log files to rotate, it
invokes /usr/sbin/syslogd-listfiles, which is a perl script. This
produces a list of log files that need rotating.

One of it's criteria is the size of the file. A comment suggests the
default size is 10MB, however the code says it is 1MB. I.e., any log
files bigger than 1Mb will get rotated.

Thus mail.log will get rotated at least on a weekly basis and more often
if it gets bigger than 1MB.

If you want to allow it grow larger, then you could edit the sysklogd
script in cron.daily. The line that contains:

	for LOG in `syslogd-listfiles`

change to:

	let size=10*1024*1024
	for LOG in `syslogd-listfiles --large $size`

for a 10MB file. Adjust the let statement to give the size you want.

You should probably also change the line:

	for LOG in `syslogd-listfiles --auth`

to:

	for LOG in `syslogd-listfiles --auth --large $size`

Note this will affect all log files maintained by the sysklogd cron job.

I've not tested any of the above, so apply with caution!

Hope this helps.

Regards,
Tony.
-- 
Tony Arnold, IT Security Coordinator, University of Manchester,
IT Services Division, Kilburn Building, Oxford Road, Manchester M13 9PL.
T: +44 (0)161 275 6093, F: +44 (0)870 136 1004, M: +44 (0)773 330 0039
E: tony.arnold at manchester.ac.uk, H: http://www.man.ac.uk/Tony.Arnold





More information about the ubuntu-users mailing list