LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Delete archived log files using logrotate (https://www.linuxquestions.org/questions/linux-newbie-8/delete-archived-log-files-using-logrotate-906178/)

vishesh 10-03-2011 07:49 AM

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

tshikose 10-03-2011 08:12 AM

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.

sundialsvcs 10-03-2011 09:27 AM

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.


All times are GMT -5. The time now is 09:33 PM.