3

My logs are being rotated properly, however, I am not being emailed the rotated log. What am I doing wrong?

My main logrotate.conf is:

include /etc/logrotate.d

here is my /etc/logrotate.d/php-errors:

/var/log/php-errors.log {
    rotate 7
    daily
    missingok
    notifempty
    mail [email protected]
}
2
  • 1
    turns out I was misunderstand the mail command. It mails the log that is about to be deleted. I wanted the log that was just rotated, so I had to add the "mailfirst" directive to my configuration file.
    – smusumeche
    Dec 17, 2014 at 20:53
  • Ah, I hadn't picked up on that error, you're quite right. Please either update your post above to reflect the solution you've found, or post it as an answer below.
    – BE77Y
    Dec 18, 2014 at 8:52

2 Answers 2

4

You will need to ensure that you have sendmail (or an equivalent MTA) correctly configured to be capable of sending mail out, then specify the full path to the command in your configuration as above in /etc/logrotate.d/php-errors;

/var/log/php-errors.log {
    rotate 7
    daily
    missingok
    notifempty
    /bin/mail [email protected]
}
1
  • I do have sendmail setup and it works on the system. When I put the absolute path like you suggested, I get this error: unexpected log filename
    – smusumeche
    Dec 17, 2014 at 20:44
4

Turns out I was misunderstand the mail command. It mails the log that is about to be deleted. I wanted the log that was just rotated, so I had to add the "mailfirst" directive to my configuration file.

You must log in to answer this question.

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