8000 Enable statement logging · chazgorman/postgres-1@7ecf5de · GitHub
[go: up one dir, main page]

Skip to content

Commit 7ecf5de

Browse files
committed
Enable statement logging
Additionally, enable logrotation on csv logs to cope with increased log sizes.
1 parent 8b4ea34 commit 7ecf5de

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

ansible/files/logrotate-postgres-csv

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/var/lib/postgresql/data/pg_log/postgresql.csv {
2+
size 50M
3+
rotate 9
4+
compress
5+
delaycompress
6+
notifempty
7+
missingok
8+
postrotate
9+
sudo -u postgres pg_ctl -D /var/lib/postgresql/data logrotate
10+
endscript
11+
}

ansible/files/postgresql_config/postgresql.conf.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ log_line_prefix = '%h %m [%p] %q%u@%d ' # special values:
570570
#log_parameter_max_length_on_error = 0 # when logging an error, limit logged
571571
# bind-parameter values to N bytes;
572572
# -1 means print in full, 0 disables
573-
#log_statement = 'none' # none, ddl, mod, all
573+
log_statement = 'all' # none, ddl, mod, all
574574
#log_replication_commands = off
575575
#log_temp_files = -1 # log temporary files equal or larger
576576
# than the specified size in kilobytes;

ansible/playbook.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@
9696
src: files/logrotate-postgres
9797
dest: /etc/logrotate.d/postgres
9898

99+
- name: Setup logrotate for postgres CSV logs
100+
copy:
101+
src: files/logrotate-postgres-csv
102+
dest: /etc/logrotate.d/postgres-csv
103+
99104
- name: Configure logrotation to run every hour
100105
shell:
101106
cmd: mv /etc/cron.daily/logrotate /etc/cron.hourly/

0 commit comments

Comments
 (0)
0