Add possibility to enable PostgreSQL query logging
This commit is contained in:
parent
0a232bcc22
commit
1f0f8ee451
@ -122,5 +122,13 @@ apt-get -y --no-install-recommends -y install postgresql-9.6 postgresql-9.6-post
|
||||
cp ${SOURCE_DIR}/basic/etc/postgresql/9.6/main/postgresql.conf /etc/postgresql/9.6/main/postgresql.conf
|
||||
cp ${SOURCE_DIR}/basic/etc/postgresql/9.6/main/pg_hba.conf /etc/postgresql/9.6/main/pg_hba.conf
|
||||
|
||||
# Enable query logging. Only if the DEBUG environment variable exists
|
||||
if [ -n "${DEBUG}" ]; then
|
||||
sed -i 's/#log_destination/log_destination/' /etc/postgresql/9.6/main/postgresql.conf
|
||||
sed -i 's/#logging_collector/logging_collector/' /etc/postgresql/9.6/main/postgresql.conf
|
||||
sed -i 's/#log_directory/log_directory/' /etc/postgresql/9.6/main/postgresql.conf
|
||||
sed -i 's/#log_statement/log_statement/' /etc/postgresql/9.6/main/postgresql.conf
|
||||
fi
|
||||
|
||||
# Restart
|
||||
systemctl restart postgresql
|
||||
|
@ -334,13 +334,13 @@ effective_cache_size = 1GB
|
||||
# requires logging_collector to be on.
|
||||
|
||||
# This is used when logging to stderr:
|
||||
#logging_collector = off # Enable capturing of stderr and csvlog
|
||||
#logging_collector = on # Enable capturing of stderr and csvlog
|
||||
# into log files. Required to be on for
|
||||
# csvlogs.
|
||||
# (change requires restart)
|
||||
|
||||
# These are only used if logging_collector is on:
|
||||
#log_directory = 'pg_log' # directory where log files are written,
|
||||
#log_directory = '/var/log/postgresql' # directory where log files are written,
|
||||
# can be absolute or relative to PGDATA
|
||||
#log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log' # log file name pattern,
|
||||
# can include strftime() escapes
|
||||
@ -450,7 +450,7 @@ log_line_prefix = '%m [%p] %q%u@%d ' # special values:
|
||||
# %% = '%'
|
||||
# e.g. '<%u%%%d> '
|
||||
#log_lock_waits = off # log lock waits >= deadlock_timeout
|
||||
#log_statement = 'none' # none, ddl, mod, all
|
||||
#log_statement = 'all' # none, ddl, mod, all
|
||||
#log_replication_commands = off
|
||||
#log_temp_files = -1 # log temporary files equal or larger
|
||||
# than the specified size in kilobytes;
|
||||
|
Loading…
Reference in New Issue
Block a user