Skip to content

Getting postfix to log properly in Gentoo

I’ve been using Gentoo a bit lately and one thing that is nice is the portage system which tends to
configure your systems rather sanely but there always needs to be tweaks…

If you install postfix and are using syslog-ng which is the default syslogging tool for Gentoo.
You’ll notice all of your postfix messages go into /var/log/messages by default. Note this sucks
since sending all syslog events to one big file is a bad idea when it comes to troubleshooting.
After googling around I dug up a perfect
describing how to configure postfix log to something more sane like /var/log/mail.log

For you lazier folk here’s the punchline. Put this in /etc/syslog-ng/syslog-ng.conf
(Note you’ll need to actually do some editing rather than just blind cut & paste):


source src { unix-stream(“/dev/log”); internal(); pipe(“/proc/kmsg”); };

destination mail { file(“/var/log/mail.log”); };
destination messages { file(“/var/log/messages”); };

destination console_all { file(“/dev/tty12”); };

filter mail { facility(mail); };
filter notmail { not facility(mail); };

log { source(src); filter(mail); destination(mail); };

log { source(src); filter(notmail); destination(messages); };

log { source(src); destination(console_all); };


Read it yourself

Be Sociable, Share!