Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2009-04-01
3
Medium Priority
?
301 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 375 total points
ID: 24040616
0
 
LVL 80

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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

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…
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
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…
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.
Suggested Courses
Course of the Month7 days, 15 hours left to enroll

824 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