Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add log #492

Merged
merged 1 commit into from
Dec 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions scripts/env-data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,64 @@ if [ -z "${SSL_KEY_FILE}" ]; then
SSL_KEY_FILE='/etc/ssl/private/ssl-cert-snakeoil.key'
fi

# log
if [ -z "${LOGGING_COLLECTOR}" ]; then
LOGGING_COLLECTOR='off'
fi

if [ -z "${LOG_DIRECTORY}" ]; then
LOG_DIRECTORY='pg_log'
fi

if [ -z "${LOG_FILENAME}" ]; then
LOG_FILENAME='postgresql-%Y-%m-%d_%H%M%S.log'
fi

if [ -z "${LOG_ROTATION_AGE}" ]; then
LOG_ROTATION_AGE='1d'
fi

if [ -z "${LOG_ROTATION_SIZE}" ]; then
LOG_ROTATION_SIZE='100MB'
fi

if [ -z "${LOG_TRUNCATE_ON_ROTATION}" ]; then
LOG_TRUNCATE_ON_ROTATION='on'
fi

if [ -z "${LOG_LOCK_WAITS}" ]; then
LOG_LOCK_WAITS='on'
fi

if [ -z "${LOG_DURATION}" ]; then
LOG_DURATION='on'
fi

if [ -z "${LOG_STATEMENT}" ]; then
LOG_STATEMENT='all'
fi

if [ -z "${LOG_MIN_DURATION_STATEMENT}" ]; then
LOG_MIN_DURATION_STATEMENT='20'
fi

if [ -z "${LOG_CONNECTIONS}" ]; then
LOG_CONNECTIONS='on'
fi

if [ -z "${LOG_DISCONNECTS}" ]; then
LOG_DISCONNECTS='on'
fi

if [ -z "${LOG_LINE_PREFIX}" ]; then
LOG_LINE_PREFIX='%m [%p]: [%l-1] %u@%d '
fi

if [ -z "${LOG_TIMEZONE}" ]; then
LOG_TIMEZONE='Etc/UTC'
fi


# SSL mode
function postgres_ssl_setup() {
if [ -z "${PGSSLMODE}" ]; then
Expand Down
17 changes: 17 additions & 0 deletions scripts/setup-conf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,23 @@ cron.database_name = '${SINGLE_DB}'
password_encryption= '${PASSWORD_AUTHENTICATION}'
timezone='${TIMEZONE}'
cron.use_background_workers = on


logging_collector='${LOGGING_COLLECTOR}'
log_directory='${LOG_DIRECTORY}'
log_filename='${LOG_FILENAME}'
log_rotation_age='${LOG_ROTATION_AGE}'
log_rotation_size='${LOG_ROTATION_SIZE}'
log_truncate_on_rotation='${LOG_TRUNCATE_ON_ROTATION}'
log_lock_waits='${LOG_LOCK_WAITS}'
log_duration='${LOG_DURATION}'
log_statement='${LOG_STATEMENT}'
log_min_duration_statement='${LOG_MIN_DURATION_STATEMENT}'
log_connections='${LOG_CONNECTIONS}'
log_disconnections='${LOG_DISCONNECTS}'
log_line_prefix='${LOG_LINE_PREFIX}'
log_timezone='${LOG_TIMEZONE}'

EOF

echo "include 'postgis.conf'" >> "${CONF}"
Expand Down
Loading