Link to home
Start Free TrialLog in
Avatar of lwfuk
lwfuk

asked on

CentOS5.2 How do I prune my log files with Cron?

Hello

With Regard to CentOS 5.2

My log files are getting quite big and I would like to setup a cron/shell script that keeps them to about 100kb.

Does anybody have a readymade solution?

Kind Regards,
Adrian Smith
London
Avatar of fosiul01
fosiul01
Flag of United Kingdom of Great Britain and Northern Ireland image

you dont need to shell or cron,
logroate will do this job for  you .


logroate should keep log file archived

http://www.linuxcommand.org/man_pages/logrotate8.html

just in google do a search for logrotate  ,
ASKER CERTIFIED SOLUTION
Avatar of fosiul01
fosiul01
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of arnold
Look in /etc/logrotate.d/.
You can replicate any one of the files there.
man logrotate will provide you information and examples you can use to create a logrotate file you can place into /etc/logrotate.d/.
The links posted earlier explain and provide additional/detailed examples.