Is there a log file size limit?

Damien Hull dhull at digitaloverload.net
Fri Sep 1 18:20:00 UTC 2006


Tony Arnold wrote:
> 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.
>   
Thanks for the info. I made the changes but I won't know if it works for 
at least a day.




More information about the ubuntu-users mailing list