• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 312
  • Last Modified:

how to clean log files at /var/log directory

I'm running out disk space on my linux box, my var/log/wtmp keep growing how i can clean up this file and some log files to free up, i'm often getting error because of this. Can any body help me. What should I do, do i have to remove this file or clean up the logs.
Thanks
0
burn2fre
Asked:
burn2fre
1 Solution
 
liddlerCommented:
cat /dev/null > /var/log/wtmp
will set it back to 0 bytes, don't delete it as the system writes to it.
You may also have a /var/log/utmp, if that's also big do the same
0
 
MikaelErikssonCommented:
To save more space you may also want to delete or archive away all the old log files. E.g. /var/log/messages.1, messages.2 ...
0
 
sppalserCommented:
As a side note to the above suggestions you should be in single user mode when you  zero out utmp & wtmp then do a reboot following so as to avoid possible corruption of these files.  Corrupt utmp & wtmp files are usually not fatal but can cause some minor issues.  You may also want to check the /var/spool directory and sub-directories for files that have grown.  Some unices keep mail files there and those can get quite large if no one checks their mail.  

Good Luck.
0
 
RenotsCommented:
burn2fre,

No comment has been added lately (213 days), so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question
is:

to be PAQ'd, with points forfeited.

Please leave any comments here within the next SEVEN days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Renots
EE Cleanup Volunteer
0
 
MindphaserCommented:
Force accepted

** Mindphaser - Community Support Moderator **
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now