Skip to main content

Exclude particular IP address from Postfix log [Resolved]

I have a postfix relay system that uses HAProxy to check to make sure Postfix is responding as it should. There is a front-end load balancer which connects using an internal IP to the backend servers. Is there any way I can exclude this particular IP address from filling up the logs? I need HAProxy to run regular checks to make sure the server is up and running but I don't want this being logged every time.

Thanks in advance, Chris.

Question Credit: Chris
Question Reference
Asked March 13, 2019
Posted Under: Network
3 Answers

rsyslog filter is easiest.

I assume you have a good network health where you register rDNS Records

Add this line before mail.*

:msg, contains, "from haproxyhostname" ~

credit: Jacob Evans
Answered March 13, 2019

I'm not clear which logs you are talking about exactly. You might be interested in the following HAProxy option log-health-checks:

However, more generally you might consider investigating filtering options in rsyslogd. Assuming you whatever log you referring to is syslog traffic, rsyslogd can do all sorts of manipulations to that log data before logging it. See rsyslog filters for examples.

credit: Kyle Brandt
Answered March 13, 2019

In addition of the answer of Jacob Evans, the IP can be added to the Postfix parameter smtpd_client_event_limit_exceptions to avoid the IP is taken into account in the statistics by anvil. In this parameter you will probably want to keep the value from $mynetworks also.

I used these two mechanisms to avoid the monitoring pollutes the Postfix log each minute.

credit: Seb35
Answered March 13, 2019
Your Answer