How to prevent PostgreSQL logging Patroni health check connections?
1
vote
0
answers
78
views
I have PostgreSQL 15.2 from the Percona repo, along with Patroni 3.0.1 as management tool, HAProxy 2.5.11 for proxying and PGBouncer 1.18.0 as server side pool and keepalived 2.1. for the virtual IP.
I have 3 nodes, I will use these IPs for the sake of this post:
10.0.1.1 is the primary, node1
10.0.1.2 is node2
10.0.1.3 is node3
HAProxy is set up to do a health check every 3 seconds:
I didn't find any way to hide this in the PostgreSQL log. Any idea? It is unnecessary and misleading log message.
listen primary
bind *:9999
option httpchk /primary
http-check expect status 200
default-server inter 3s fall 3 rise 2 on-marked-down shutdown-sessions
server node1 10.1.0.1:6432 check port 8008
server node2 10.1.0.2:6432 check port 8008
server node3 10.1.0.3:6432 check port 8008
6432 is the PGBouncer port which will actually receive the SQL traffic, but health check is done over http on port 8008 with Patroni.
This causes Patroni to each time make a TCP ping to each PostgreSQL node, resulting in the following very ugly PostgreSQL logs every 3 seconds on every node:
2024-11-26 20:45:04.200 CET - Process=, Application=[[unknown]], User=[[unknown]]@[10.0.1.1(36024)]/[[unknown]], SessionID=[67462540.4d387], Session start=[2024-11-26 20:45:04 CET], Command tag=[]: LOG: could not receive data from client: Connection reset by peer
2024-11-26 20:45:05.152 CET - Process=, Application=[[unknown]], User=[[unknown]]@[10.0.1.2(48138)]/[[unknown]], SessionID=[67462541.4d391], Session start=[2024-11-26 20:45:05 CET], Command tag=[]: LOG: could not receive data from client: Connection reset by peer
2024-11-26 20:45:06.202 CET - Process=, Application=[[unknown]], User=[[unknown]]@[10.0.1.3(51212)]/[[unknown]], SessionID=[67462542.4d39d], Session start=[2024-11-26 20:45:06 CET], Command tag=[]: LOG: could not receive data from client: Connection reset by peer
On a network level it is a simple 3-way TCP handshake, closed immediately:

Asked by Gábor Major
(163 rep)
Nov 26, 2024, 09:01 PM
Last activity: Nov 27, 2024, 05:29 PM
Last activity: Nov 27, 2024, 05:29 PM