Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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
share|improve this question

2 Answers 2

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

share|improve this answer
    
Restarted sendmail and rsyslog(sudo service sendmail restart and sudo service rsyslog restart) to no avail. –  kidmose Feb 5 at 10:59
3  
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 at 19:02
    
@Dan: You're right, solved it. –  kidmose Feb 6 at 10:43
up vote 2 down vote accepted
  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

share|improve this answer

Your Answer

 
discard

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.