LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 10-03-2011, 07:49 AM   #1
vishesh
Member
 
Registered: Feb 2008
Distribution: Fedora,RHEL,Ubuntu
Posts: 653

Rep: Reputation: 66
Delete archived log files using logrotate


Hi All

I want to know , is it possible to delete archived log files using logrotate script. Suppose i don't want to keep /var/log/message beyond 1 day, will following will serve my purpose ?

/var/log/message
{
daily
rotate 0
}

Thanks for your attention
 
Old 10-03-2011, 08:12 AM   #2
tshikose
Member
 
Registered: Apr 2010
Location: Kinshasa, Democratic Republic of Congo
Distribution: RHEL, Fedora, CentOS
Posts: 134

Rep: Reputation: 30
Hi,

From
Quote:
/etc/logrotate.conf
and
Quote:
man logrotate
/var/log/messages {
rotate 1
daily
postrotate
/sbin/killall -HUP syslogd
endscript
}

Should do what you want.
Bear in mind 1 day of /var/log/message is not enough. I recommend you keep the default.

Take care,

Tshimanga.
 
Old 10-03-2011, 09:27 AM   #3
sundialsvcs
Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 5,263

Rep: Reputation: 1080Reputation: 1080Reputation: 1080Reputation: 1080Reputation: 1080Reputation: 1080Reputation: 1080Reputation: 1080
If I recall correctly, the logrotate configuration file has an option for killing the files after a certain number of days.

As for me, I never do that. Disk space is cheap.
 
  


Reply

Tags
centos, log, logrotate


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
logrotate httpd log files linux_bud Linux - Newbie 3 01-11-2010 05:13 AM
logrotate log files rashmeepawar Linux - Server 1 10-21-2009 05:14 AM
Can logrotate set limits on archived file size? 0xdefec8 Linux - Server 1 04-05-2008 08:22 PM
how to logrotate auth.log files? clintcan Linux - Security 1 12-10-2005 04:55 PM
How to add my log files in logrotate Groucho Slackware 2 10-03-2003 08:16 AM


All times are GMT -5. The time now is 12:54 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration