Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 01-19-2009, 11:29 AM   #1
LQ Newbie
Registered: Jun 2008
Posts: 9

Rep: Reputation: 0
Clearing log files

Can anyone tell me how to clear log files, also how to clear log files on boot.


Old 01-19-2009, 11:55 AM   #2
Registered: Jan 2009
Posts: 39

Rep: Reputation: 16
just try with :
#du -s /var/log/* | less to see hoe big are the logs files and directories

# rm /var/log/*.gz
# rm /var/log/*.old

www unixmen net
Old 01-19-2009, 12:19 PM   #3
LQ 5k Club
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
Logfiles are rotated, so I would suggest to remove the old files.
I see no use in clearing log files on boot
Old 01-19-2009, 12:27 PM   #4
LQ Guru
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
If you really want to clear log files (not the archived ones, but those ones actually in use) do not remove them, otherwise the process that keep them open will not find them anymore and the logging is lost (until you restart the processes/services). So, if the question is "how to empty a log file" the answer is simply
: > file.log
where the colon is the null command, or just simply
> file.log
Anyway, I agree with repo and I strongly suggest to not clear them, since will come a day you need that information... you never know! Eventually, if the disk space is an issue try to find out which application produces the most amount of log messages and try to limit it, just acting on the configuration of the application itself.


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
Clearing all the log files. crackerB Linux - Server 3 12-31-2007 06:53 AM
Clearing last log keysorsoze Linux - General 2 10-28-2006 08:03 AM
Clearing the var/log/adm/messages? as400 Solaris / OpenSolaris 17 04-17-2006 03:41 AM
clearing log files curos Slackware 1 08-05-2005 01:51 AM
Can log files be time stamped? (such as FTP login and transfer log files) bripage Linux - Networking 6 08-08-2002 10:55 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:51 AM.

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