I am running postgresql16
(apk add --no-cache postgresql16
) in docker but I think docker is irrelevant in this topic.
My postgres container is endlessly logging empty statements, this:
2025-06-15 14:07:43.774 UTC [postgres] [127.0.0.1(45942)] [application] [default_db] LOG: statement:
2025-06-15 14:07:45.831 UTC [postgres] [127.0.0.1(45942)] [application] [default_db] LOG: statement:
2025-06-15 14:07:45.831 UTC [postgres] [127.0.0.1(45942)] [application] [default_db] LOG: statement:
2025-06-15 14:07:47.889 UTC [postgres] [127.0.0.1(45942)] [application] [default_db] LOG: statement:
2025-06-15 14:07:47.889 UTC [postgres] [127.0.0.1(45942)] [application] [default_db] LOG: statement:
2025-06-15 14:07:48.504 UTC [postgres] [127.0.0.1(45956)] [application] [default_db] LOG: statement:
2025-06-15 14:07:49.947 UTC [postgres] [127.0.0.1(45942)] [application] [default_db] LOG: statement:
2025-06-15 14:07:49.948 UTC [postgres] [127.0.0.1(45942)] [application] [default_db] LOG: statement:
I use the following log settings in my postgresql.conf
:
#------------------------------------------------------------------------------
# REPORTING AND LOGGING
#------------------------------------------------------------------------------
logging_collector = on
log_directory = '${POSTGRES_LOG_DIR}'
log_filename = 'postgresql.log'
log_min_messages = 'warning'
log_min_error_statement = 'error'
log_min_duration_statement = -1
log_line_prefix = '%m [postgres] [%r] [%u] [%d]
log_statement = 'all'
Could you please help me to turn off this endless empty statement logs?
From the documentation here, it looks like you'll have to change postgresql.conf
file from:
log_statement = 'all'
to:
log_statement = 'none'