LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   Log files - safe to delete? (http://www.linuxquestions.org/questions/linux-software-2/log-files-safe-to-delete-920219/)

Thor_2.0 12-23-2011 12:10 PM

Log files - safe to delete?
 
Hi,

Okay, I admit: this may be a noob question, but, I want to make sure, so here goes.

I"ve sniffed on the hard drive (yea' I know, I need a hobby :p ) and found I plunged from 1.4Gb to ... 520Mb worth of filesystem space :( . What gives? I've got ... 670Mb worth of log files :scratch: . Now, I know (duh) I can just delete the stuff, but (here's the reason of my question) is'nt there a more elegant way to do this? A util to clean out logs or something?

Thanks and festive greetings

Thor

catkin 12-23-2011 12:20 PM

logrotate is the standard way to housekeep log files

repo 12-23-2011 12:24 PM

You can use logrotate.
You can specify the size before rotating, run a script to delete the rotated logfiles etc.
http://www.thegeekstuff.com/2010/07/logrotate-examples/

Kind regards

Thor_2.0 12-23-2011 01:12 PM

Thanks to both of you! I'll dive right into the man pages and get the place cleaned up!

Thor

Thor_2.0 12-24-2011 02:55 AM

Addendum:

For anyone with the same log file issues as I had, the logrotate comand is the best way around (as suggested here by some wiser ones ;) ) so a complete command as follows should do, exec as Root:
Quote:

logrotate -f -v /etc/logrotate.conf
Assuming your logrotate.conf is in /etc, of course.

Just to help out and shorten someone's search!

Festive greetings!

Thor

catkin 12-24-2011 05:09 AM

Most (?) distros run logrotate daily via cron or anacron and the /etc/cron.daily/logrotate file.

rich_c 12-24-2011 07:47 AM

Personally, I use bleachbit run as root.

Thor_2.0 12-24-2011 11:41 AM

@catkin - indeed, logrotate is a dayly event here too, but...I panic quickly and then I need to resolve things quickly, so hence the tip above...
@rich c - bleachbit? Never heared of that, thanks, lemme look into that


All times are GMT -5. The time now is 07:04 PM.