Operating System - Linux
1820733 Members
3211 Online
109627 Solutions
New Discussion юеВ

Re: How Do I set the filesize for the cron logs

 
SOLVED
Go to solution
Raynald Boucher
Super Advisor

How Do I set the filesize for the cron logs

Hello all,
I'm running "Linux 2.4.18-6mdk" and compressing logs every week using logrotate.
My problem is that the cron logs only hold about 1.5 days information, acting as a circular buffer.

Where/How can I specify the cron (or any other) log to be sequential and unlimited size?

Thanks
9 REPLIES 9
Steven E. Protter
Exalted Contributor

Re: How Do I set the filesize for the cron logs

Shalom Raynald,

You might want to look at /etc/syslog.conf

I've never heard of a setup like this.

It may be that the system is running logrotate.

If its a logroate configuration problem its probably in /etc/logroate.d

There are a series of files in there named for the daemon log they are controlling.

Check ou the one for cron and perhaps post it. Also determine if logroate is running. For red hat compatibles: chkconfig --list | grep logrotate

I'm wondering if the setup was done to limit log size. Its certainly possible to locate these logs on NFS or other external storage.

Regards,

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Raynald Boucher
Super Advisor

Re: How Do I set the filesize for the cron logs

You are right, we are using logrotate.
It works great, weekly.
My problem is that the /var/log/cron/info files only contain the latest 1.5 day's info. It looks like the cron writer is using a circular buffer.

Here is the /etc/logrotate.d/cron file:

/var/log/cron {
missingok
notifempty
postrotate
/bin/kill -HUP `/bin/cat /var/run/crond.pid`
endscript
}

and the /etc/logrotate.conf with comments removed

weekly
rotate 4
create
compress
include /etc/logrotate.d
/var/log/wtmp {
monthly
create 0664 root utmp
rotate 1
}
/var/log/lastlog {
monthly
rotate 1
}

Weird
Vitaly Karasik_1
Honored Contributor

Re: How Do I set the filesize for the cron logs

May be you just don't have cronjobs on Sunday-Thursday?

There is no size limitation in cron daemon itself. We can limit log size using logratete, but in default configuration it's unlimited. [in fact, logratete size limit will just activate log rotation when logfile reaches the limit. it won't drop some part of log]

Can you please remove (comment) cron logs rotation in logrotate?
Ivan Ferreira
Honored Contributor

Re: How Do I set the filesize for the cron logs

There is something extrange:

The logrotate configuration is:

/var/log/cron {
missingok
notifempty
postrotate
/bin/kill -HUP `/bin/cat /var/run/crond.pid`
endscript
}

That means that the file to be proceses is /var/log/cron

And you are talking about a file in the directory /var/log/cron called info (/var/log/cron/info)

So, I think that logrotate is not working because it won't act over directories. And I don't ever heard about the /var/log/cron/info file. Normally, cron logs are in the /var/log/cron file.

What is your Linux distribution?
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Raynald Boucher
Super Advisor

Re: How Do I set the filesize for the cron logs

Distribution is Mandrake 9.2.
Logrotate is working as seen below... Notice how all files are rotated on Sundays. I don't know what happened today to info.1...

# ll cron
total 176
-rw-r----- 1 root root 0 Dec 11 01:02 errors
-rw-r----- 1 root root 29 Dec 4 01:02 errors.1.gz
-rw-r----- 1 root root 29 Nov 27 01:02 errors.2.gz
-rw-r----- 1 root root 29 Nov 20 01:02 errors.3.gz
-rw-r----- 1 root root 29 Nov 13 01:02 errors.4.gz
-rw-r----- 1 root root 29 Nov 6 01:02 errors.5.gz
-rw-r----- 1 root root 85991 Dec 14 09:45 info
-rw-r----- 1 root root 0 Dec 14 02:30 info.1
-rw-r----- 1 root root 15748 Dec 4 01:02 info.2.gz
-rw-r----- 1 root root 16186 Nov 27 01:02 info.3.gz
-rw-r----- 1 root root 0 Nov 23 02:30 info.4.gz
-rw-r----- 1 root root 16068 Nov 13 01:02 info.5.gz
-rw-r----- 1 root root 0 Dec 11 01:02 warnings
-rw-r----- 1 root root 31 Dec 4 01:02 warnings.1.gz
-rw-r----- 1 root root 31 Nov 27 01:02 warnings.2.gz
-rw-r----- 1 root root 31 Nov 20 01:02 warnings.3.gz
-rw-r----- 1 root root 31 Nov 13 01:02 warnings.4.gz
-rw-r----- 1 root root 31 Nov 6 01:02 warnings.5.gz
# pwd
/var/log
Vitaly Karasik_1
Honored Contributor
Solution

Re: How Do I set the filesize for the cron logs

- Can you send us cron-related strings from /etc/syslog.conf?
- Check root's inbox box emails with notifications from cron
Alan_152
Honored Contributor

Re: How Do I set the filesize for the cron logs

change the timing on cron so that logrotate doesn't run as often.,
Raynald Boucher
Super Advisor

Re: How Do I set the filesize for the cron logs

# grep cron /etc/syslog.conf
cron.=debug;cron.=info;cron.=notice -/var/log/cron/info
cron.=warn -/var/log/cron/warnings
cron.err -/var/log/cron/errors
Raynald Boucher
Super Advisor

Re: How Do I set the filesize for the cron logs

Thank you Vitaly.
You put me on the right track.

Turns out that our old server had a home grown log purge that truncated (daily) the cron logs after they got bigger than 16K.
We implemented logrotate when we upgraded but forgot to remove the old truncate entry.

Let's see how many others there are...

Thanks again.
RayB