Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2009-04-01
3
Medium Priority
?
297 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 375 total points
ID: 24040616
0
 
LVL 79

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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Network Interface Card (NIC) bonding, also known as link aggregation, NIC teaming and trunking, is an important concept to understand and implement in any environment where high availability is of concern. Using this feature, a server administrator …
Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses

688 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