On 11 Jan 2019, at 4:08 am, Wietse Venema <wie...@porcupine.org> wrote: > > Larry Stone: >>> # Log file to use for error messages. "syslog" logs to syslog, >>> # /dev/stderr logs to stderr. >>> #log_path = syslog >>> log_path = /var/log/mail.log >>> >>> So I?ve had to change this so that it writes directly to the file, and not >>> to syslog. >> >> Ah. So Dovecot has the ability to write logs directly. I believe >> Wietse has stated in the past that no such capability exists in >> Postfix and it only logs to the syslog daemon. And it?s the changes >> Apple has made to syslog that are the issue. > > Is that better than Bill Cole's solution to run a log exporter at > system startup? > > If both Dovecot and Postfix write to the same logfile, that would > be a disaster. > > - The only way to make multiple logfile writers safe is that each > logfile writer flushes its own buffers after every log call, and > that would be disastrous for performance. See the Postfix > LINUX_README for a discussion. It may be OK for MacOS but it is > not good for real servers. > > - If individual programs write directly to the logfile, flushing > after every log call is also required to avoid losing logs when > a program crashes, and that is when logs are needed most. > > - The only way to make logging performant is to have a single writer > that has a limited-size write buffer (like syslogd and rsyslogd). > > Therefore, > > - Postfix and Dovecot cannot share logfiles. But there is nothing > to enforce that, because there are no mandatory locks. > > - Postfix needs its own logger daemon, which brings major challenges > when Postfix is not (yet) running. > > - What happens with logging during Postfix startup? > Hack the log client code to directly write to the logfile? Will > it even be allowed to write outside the Postfix queue? If every > program opens the logfile as root, it has to make sure that the > file is not a symlink, has no multiple hard links, etc. > > - What happens with logging from non-daemon programs when Postix > is down? Unless the logfile is world-writable, those prograns > will have nowhere to log. This affects programs that invoke > /bin/mail before Postfix is up; we should not assume that such > programs will always run as root. > > - Log rotation support. Postfix cannot keep appending to the > same file forever. It may be OK for MacOS but it is not good > for real servers. Basically re-invent the log rotation wheel. > > Wietse
Thanks Wietse, Larry, Robert and Bill. I really appreciate your help. Wietse, thanks for pointing out all the problems of Postfix logging without syslog. I have created a script that runs Bill’s log command to send it to a file. Not the same log file that Dovecot is using. Created a LaunchDaemon to open the script at startup. Seems to work perfectly, so thanks again everyone. James.