4

Previously I was using tail -f /var/log/maillog on Centos 6

When trying tail -f /var/log/maillog in CentOS 7 it says:

cannot open ‘/var/log/maillog’ for reading: No such file or directory
tail: no files remaining

So how to tail maillog in CentOS 7 ?

  • It seems the file /var/log/maillog does not exist..go to /var/log directory and check the files.. – heemayl Aug 12 '15 at 8:29
  • 1
    How its possible maillog is not there ? Can I install it ? ... btmp, dovecot-lmtp.log, freshclam.log, mariadb, tallylog, cbpolicyd.log, dovecot.log, httpd, openldap.log, wtmp, dmesg, dovecot-sieve.log, iredapd.log, postinstall.log, yum.log, dmesg.old, firewalld, lastlog, sa-update.log – batersi Aug 12 '15 at 8:42
1

The location of maillog is still the same in CentOS 7, so maybe it's just that nothing has written to it. Try creating a mail log event like this:

logger -p mail.info Testing

Then tail the log file again, and see if it's there. If that doesn't work, try creating the log file and try again:

sudo touch /var/log/maillog
sudo chmod 600 /var/log/maillog
logger -p mail.info Testing

If it still doesn't work, try restarting rsyslog with sudo service rsyslog restart and try creating an event again. If it's not there after that, it might be a problem in /etc/rsyslog.conf.

1

If you check the permissions of /var/log/maillog

ls -l /var/log/maillog

You will see

-rw-------. 1 root root 5844 Apr 26 20:58 /var/log/maillog

In CentOS 7, you have to belongs to sudoers and do

sudo tail -f /var/log/maillog
1

I had this problem with Centos7 that had no maillog. Turns out rsyslog was simply not installed and I was doing just yum install syslog saying it was installed.

yum install rsyslog maillog was auto created I was able to tail -t the file and see my mail activity.

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.