Solved

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

Posted on 2009-04-01
3
245 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
Comment Utility
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
Comment Utility
0
 
LVL 76

Expert Comment

by:arnold
Comment Utility
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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

This is the error message I got (CODE) Error caused by incompatible libmp3lame 3.98-2 with ffmpeg I've googled this error message and found out sometimes it attaches this note "can be treated with downgrade libmp3lame to version 3.97 or 3.98" …
How many times have you wanted to quickly do the same thing to a list but found yourself typing it again and again? I first figured out a small time saver with the up arrow to recall the last command but that can only get you so far if you have a bi…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
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.

762 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now