Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a ubuntu server which handles mail via postfix. The server has recently been caned by spam emails and the mail logs are really large as a consequence. The logs are stored with timestamps and I was just wondering if I can just clear out the old logs without consequence to recover some disk space?

Also, being none-too-clever about such things, I am struggling to see where to change the settings for log rotation and deletion... any clues from more knowledgable folks?

share|improve this question
Cheers for the replies. Removing the huge old logs and investigating more of logrotate. – amacbishop Dec 13 '10 at 21:54

You should be able to delete them. That assumes you'll never need to refer back to them. Check /etc/logrotate.d/rsyslog for rotating the mail logs.

share|improve this answer

If you dont care about what you'll be missing, you have two ways of removing the content of logfiles. One, is of course, removing it, but if you do this, the file will still exist with its content (syslog daemon has it open, and appending content to it).

# /etc/init.d/<daemon> stop
# rm /var/log/mail.log
# /etc/init.d/<daemon> start

Depending on what syslog daemon you are using, just replace its name, as well as the maillog.

The other way arround, is to truncate the file:

 #  > /var/log/mail.log

Logs on Debian-like systems are usually rotated with logrotate. In /etc/logrotate.d you'll find config files, and man can help you a lot. It is fairly simple to setup.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.