Page MenuHomeSoftware Heritage

Too many postgresql logs on dbreplica0.euwest.azure.internal.softwareheritage.org
Closed, MigratedEdits Locked

Description

The PostgreSQL instance on dbreplica0.euwest.azure.internal.softwareheritage.org writes logs of all SQL queries to the /var/log/postgresql directory.
These logs have been accumulating for months, causing the root filesystem to become full.

Event Timeline

ftigeot changed the task status from Open to Work in Progress.Jan 30 2019, 10:35 AM
ftigeot triaged this task as Normal priority.
ftigeot created this task.

There is no need to log all production queries on this server.
Reducing logged contents to queries taking more than one millisecond to execute:

[/etc/postgresql/10/replica/postgresql.conf]

-log_min_duration_statement = 0 # -1 is disabled, 0 logs all statements
+log_min_duration_statement = 1 # -1 is disabled, 0 logs all statements

Only keep 24 hours of log, and keep rotating on the same file names:

[/etc/postgresql/10/replica/postgresql.conf]

-log_filename = 'postgresql-10-replica-%Y-%m-%d_%H%M%S.log'
+log_filename = 'postgresql-10-replica-%H%.log'
-#log_truncate_on_rotation = off
+log_truncate_on_rotation = on