Thursday, April 14, 2011

clear logs

refer to this page


cat /dev/null > /var/log/messages
cat /dev/null > /var/log/wtmp
cat /dev/null > /var/log/maillog

etc..

this will delete the contents of the file without removing the file itself or changing any of it's permissions. Repeat as necessary for each log file, write into a bash script whatever.. then delete all the numbered log files ( i.e. messages.1.tar.gz ) which are old logs that have been backed up from logrotate or a similar app.

from farslayer

some error logs with location

cat /dev/null > /var/log/messages
cat /dev/null > /var/log/openwebmail.log
cat /dev/null > /var/log/maillog
cat /dev/null > /var/log/secure
cat /dev/null > /var/log/httpd/error_log
cat /dev/null > /var/log/httpd/ssl_error_log
cat /dev/null > /var/log/httpd/ssl_request_log
cat /dev/null > /var/log/httpd/ssl_access_log

No comments:

Related Posts Plugin for WordPress, Blogger...