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" kidmose@gmail.com
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
  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 '15 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 '15 at 19:02
  • @Dan: You're right, solved it. – kidmose Feb 6 '15 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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