Skip to content

Commit

Permalink
use syslog as default logger
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandermeindl committed Dec 16, 2024
1 parent 773c90e commit 588d971
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 10 deletions.
13 changes: 11 additions & 2 deletions roles/postgresql/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ postgresql_wal_buffers: -1

# see https://docs.timescale.com/self-hosted/latest/install/installation-linux/#install-and-configure-timescaledb-on-postgresql
postgresql_with_timescaledb: false
# see https://docs.timescale.com/self-hosted/latest/configuration/timescaledb-config/#timescaledblicense-string
postgresql_timescaledb_license: timescale
# see https://docs.timescale.com/self-hosted/latest/configuration/telemetry/#disabling-telemetry
postgresql_timescaledb_telemetry_level: false

# deb https://packagecloud.io/timescale/timescaledb/debian/ bookworm main
postgresql_timescaledb_apt_url: https://packagecloud.io/timescale/timescaledb/{{ ansible_distribution | lower }}
Expand Down Expand Up @@ -111,9 +115,14 @@ postgresql_ssl_cert_file: '/etc/ssl/certs/ssl-cert-snakeoil.pem'
postgresql_ssl_crl_file: ''
postgresql_ssl_key_file: '/etc/ssl/private/ssl-cert-snakeoil.key'

postgresql_log_destination: stderr
postgresql_log_destination: syslog
postgresql_syslog_facility: local0
postgresql_syslog_ident: postgres
postgresql_syslog_sequence_numbers: false
postgresql_syslog_split_messages: false

postgresql_log_statement: none
postgresql_log_line_prefix_syslog: 'user=%u,db=%d,app=%aclient=%h '
postgresql_log_line_prefix_syslog: 'user=%u,db=%d,client=%h,app=%a '
postgresql_log_line_prefix_stderr: '%t [%p]: [%l-1] user=%u,db=%d,app=%a,client=%h '
# disabled, if -1
postgresql_log_min_duration_statement: 2000
Expand Down
23 changes: 15 additions & 8 deletions roles/postgresql/templates/postgresql.j2
Original file line number Diff line number Diff line change
Expand Up @@ -484,20 +484,20 @@ log_destination = '{{ postgresql_log_destination }}' # Valid values are combina
# or size-driven rotation. Default is
# off, meaning append to existing files
# in all cases.
{% if postgresql_log_destination == "syslog" %}

# These are relevant when logging to syslog:
syslog_facility = 'LOCAL0'
syslog_ident = 'postgres'
syslog_sequence_numbers = on
syslog_split_messages = on
{% endif %}

# These are relevant when logging to syslog:
#syslog_facility = 'LOCAL0'
#syslog_ident = 'postgres'
#syslog_sequence_numbers = on
#syslog_split_messages = on
{% if postgresql_log_destination == "syslog" %}

# These are relevant when logging to syslog:
syslog_facility = '{{ postgresql_syslog_facility }}'
syslog_ident = {{ postgresql_syslog_ident }}
syslog_sequence_numbers = {{ 'on' if postgresql_syslog_sequence_numbers else 'off' }}
syslog_split_messages = {{ 'on' if postgresql_syslog_split_messages else 'off' }}
{% endif %}

# This is only relevant when logging to eventlog (Windows):
# (change requires restart)
Expand Down Expand Up @@ -773,6 +773,13 @@ pg_stat_statements.track = {{ postgresql_pg_stat_statements_track }}
{% endif %}
#jit_provider = 'llvmjit' # JIT library to use

{% if postgresql_with_timescaledb %}
# see https://docs.timescale.com/self-hosted/latest/configuration/timescaledb-config/#timescaledblicense-string
timescaledb.license = '{{ postgresql_timescaledb_license }}'
# see https://docs.timescale.com/self-hosted/latest/configuration/telemetry/#disabling-telemetry
timescaledb.telemetry_level = {{ 'off' if not postgresql_timescaledb_telemetry_level else postgresql_timescaledb_telemetry_level }}
{% endif %}

# - Other Defaults -

#dynamic_library_path = '$libdir'
Expand Down

0 comments on commit 588d971

Please sign in to comment.