PDA

View Full Version : Log compressing every once a week



firebirdfan
11-25-2003, 12:24 AM
Hi, being new to server settings, I would like to know where to set my log rotation settings to set it be compressed at once a week , rather than the default setting.

thanks

wildjokerdesign
11-25-2003, 10:48 AM
/etc/logrotate.conf

Is where the config file is. Got that off of Jalal WestHost help site while I was looking for info on installing a perl mod. Still haven't figured that one out all the way but thought I would pass this on to you. I looked at mine and was not sure what you set to change the frequency. I think it is the rotate 5 but that is just a guess. I also see size variables so maybe that is what you want to change.

torrin
11-25-2003, 10:55 AM
Check out the logrotate man page.

http://www.rt.com/man/logrotate.8.html

More specifically, look at the daily, weekly and monthly settings.

wildjokerdesign
11-25-2003, 11:07 AM
Thanks for the link Torrin. It looks like from reading it that firebirdfan would want to replace the size=whatever with one of the following

daily
weekly
monthlyIt looks like the rotate is how many times it is rotated before it removes it form the server.

firebirdfan
11-25-2003, 09:02 PM
Hmmm, thanks Torin for the link - Shadow Mountain sure is a good source for all the unix explanations.
I'm fiddling with the conf now, set the weekly rotation & increased the size, removed certain log file reports - eg: ssl, agent, which is uneccessary to me.

But I would like to keep the the compress logs in the server rather than deleting them.
Should I use the copytruncate option ?

Can I also name the log file a particular name with respect to the domain in particular ?

My current conf looks

compress
missingok
rotate 5
weekly

/var/log/httpd/access_log /var/log/httpd/error_log {
sharedscripts
size=4M
prerotate
/bin/web_logs.sh
endscript
postrotate
kill -HUP `cat /var/run/httpd.pid`
endscript
}

/var/log/maillog {
size=500k
}

THe bigger the size I allow the the log before it rotates & compresses will it affect server performance ?

With regards to size & rotate, which will come first ?
If Size has reached 4M first before the week ends than it has entered the first rotation, so if my daily logs ex: is at 4M/day .
Then after 5 days= 5 rotations , the files will be deleted ? So making the weekly command nullified ?