postgres: log metadata about queries and system performance, and 1/100th of transactions
Hopefully 1/100 is low enough to not be a ton of spew, but high enough to be useful. I'm starting lower than I expect I'll need to be cautious.
Graham Christensen committed
Mar 9, 2021 at 21:10 UTC
695f141d47c364212bf5213a570d16f854ca9313
1 file changed
+12
-1
delft/haumea.nix
+12
-1
@@ -87,15 +87,26 @@
87
package = pkgs.postgresql_12;
88
dataDir = "/var/db/postgresql";
89
# https://pgtune.leopard.in.ua/#/
90
+ logLinePrefix = "%t [%p]: user=%u,db=%d,app=%a,client=%h ";
91
settings = {
92
listen_addresses = lib.mkForce "10.254.1.9";
93
94
checkpoint_completion_target = "0.9";
95
default_statistics_target = 100;
96
96
- log_min_duration_statement = 5000;
97
log_duration = "off";
98
log_statement = "none";
99
+
100
+ # pgbadger-compatible logging
101
+ log_transaction_sample_rate = 0.01;
102
+ log_min_duration_statement = 5000;
103
+ log_checkpoints = "on";
104
+ log_connections = "on";
105
+ log_disconnections = "on";
106
+ log_lock_waits = "on";
107
+ log_temp_files = 0;
108
+ log_autovacuum_min_duration = 0;
109
+
110
max_connections = 250;
111
work_mem = "20MB";
112
maintenance_work_mem = "2GB";