logrotate && cron
Hi -- running YellowDog on my mac -- I think this is probably the best forum to ask in...
Having problems getting my logs to rotate. Specifically I'm worried about my httpd logs. There is a script in /etc/cron.daily for logrotate, which looks fine: Code:
#!/bin/sh Code:
/var/log/httpd/*log { error: bad year 1970 for file /var/log/cups/error_log in state file /var/lib/logrotate.status and "/var/lib/logrotate.status" looks like this: Code:
logrotate state -- version 2 |
Moved: This thread is more suitable in Linux-General and has been moved accordingly to help your thread/question get the exposure it deserves.
|
I'd suggest "touching" all files to reflect a more recent
date ... :) Cheers, Tink |
Well, the old dates are really only a part of the "/var/lib/logrotate.status" file... the actual files themselves in /etc/log/* all reflect current date/time-stamps (except for the files that don't get logged to because I don't use the service -- like cups).
So, pretty much all the files in the httpd directory (access_log, agent_log, etc), all have time-stamps of today. I did notice something odd in "/etc/logrotate.d/": Code:
total 48 I've set the httpd script a+x to match cups, and I guess we'll see if that solves the problem, but I don't understand why this installation set up logrotate.d like this... seems odd for a default server install. If you recognize that this is probabaly the cause of my problem, I certainly wouldn't mind you posting back to let me know... otherwise, I guess we'll wait until tonite to see. :) |
That executable bit shouldn't make a difference ...
What I'd suggest is to see what happens if you manually update the state file now ... :) (after having made a backup-copy, of course ;}) ... sed -i 's/1970-1-11/2004-10-11/g' var/lib/logrotate.status Cheers, Tink |
OK, we'll give that a shot and see what happens.
As an aside -- there's no specific reason you picked 2004-10-11 is there? It doesn't appear anywhere else really... your birthday, maybe? :) (Or you really like Eleanor Roosevelt.) |
I actually picked it because that is what my status file has ;)
Cheers, Tink |
In that case, I hope yours is working. ;-D
|
Heh ... it is ;)
Cheers, Tink |
All logs seem to be getting rotated correctly now.
The solution was Tink's updating of the logrotate state file with: sed -i 's/1970-1-11/2004-10-11/g' var/lib/logrotate.status Seemed to do the trick. My suggestion that setting the executable bit on the httpd script in /etc/logrotate.d couldn't have been the solution because as of now, there are only two scripts in that file with executable bits set - the httpd and cups scripts - and many more logs than those associated with those two scripts have been rotated by cron overnite. Many thx to Tink -- expect an affero soon! |
All times are GMT -5. The time now is 11:48 AM. |