Solved

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

Posted on 2009-04-01
3
280 Views
Last Modified: 2012-05-06
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
0
Comment
Question by:lwfuk
  • 2
3 Comments
 
LVL 29

Expert Comment

by:fosiul01
ID: 24040589
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  ,
0
 
LVL 29

Accepted Solution

by:
fosiul01 earned 125 total points
ID: 24040616
0
 
LVL 78

Expert Comment

by:arnold
ID: 24040820
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.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question