To clear the mail log I deleted /var/log/mail.log and /var/log/mail.err.

Now it seems like I've broken something as the files are not recreated as I interact with mail:

kidmose@radagast:~$ echo "Test text" | mail -s "From radagast" [email protected]
kidmose@radagast:~$ cat /var/log/mail.log
cat: /var/log/mail.log: No such file or directory

Any ideas as how to make logging work again?

(Ideally without reinstall or reboot)

My setup:

kidmose@radagast:~$ uname -a
Linux radagast 3.13.0-32-generic #57-Ubuntu SMP Tue Jul 15 03:51:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
kidmose@radagast:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.1 LTS
Release:    14.04
Codename:   trusty

5 Answers 5

  1. Remove the files belonging to root (If there), as suggested by @Dan.
  2. Restart MTA(sendmail in my case) and syslog, as suggested by @drookie

    sudo service sendmail restart 
    sudo service rsyslog restart

Bonus info: The files will then be created as syslog:adm


touch /var/log/mail.log /var/log/mail.err, then restart whatever is writing to them, like your MTA or syslog.

  • Restarted sendmail and rsyslog(sudo service sendmail restart and sudo service rsyslog restart) to no avail.
    – kidmose
    Feb 5, 2015 at 10:59
  • 4
    If you did not forcefully created them with the touch commands, restarting syslog should do the trick (depending on the configuration, syslog may not create them as root)
    – Dan
    Feb 5, 2015 at 19:02
  • @Dan: You're right, solved it.
    – kidmose
    Feb 6, 2015 at 10:43

On Ubuntu 16.04.3 LTS:

  1. touch /var/log/mail.log /var/log/mail.err
  2. chown syslog:adm /var/log/mail.log /var/log/mail.err
  3. service postfix reload

After those three commands you should have new records inside of /var/log/mail.log:

Jan 18 05:14:21 ubuntu-srv postfix/master[9405]: reload -- version 3.1.0, configuration /etc/postfix

Another way to see some short history of necessary logs including whats happeinging postfix is the journalctl command


In my case, ubuntu 8 (i know old one...) 1. Restart OS. 2. touch /var/log/mail.log 3. chown syslog:adm /var/log/mail.log

mail.log is now filling with data... It was big relief. Aleksej

  • Step 1 should have been sufficient on its own.
    – womble
    Oct 6, 2019 at 5:21

In my case helped only this one command service rsyslog restart and mail.log was created and written ok, because touch /var/mail.log just created file but was never written and restart or stop/start of postfix did not solved it. After service rsyslog restart free space reported by df was finally released. Before I had free space just 3GB and after service rsyslog restart 6 GB. I was not able to detect what occupies too many space. It was huge mail.log which was deleted but free space never released. Strange.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .