vitabaks / postgresql_cluster

PostgreSQL High-Availability Cluster (based on Patroni). Automating with Ansible.
https://postgresql-cluster.org
MIT License
1.48k stars 395 forks source link

No logs in /var/log/postgresql #711

Closed xRTRx closed 4 weeks ago

xRTRx commented 1 month ago

Used tag: 1.10.0 3 identical vms with Ubuntu 22.04.4 LTS Variables:

cluster_vip: "172.16.47.32"

patroni_installation_method: "deb"
patroni_log_destination: 'logfile'

patroni_superuser_password: "{{ patroni_superuser_password }}"
patroni_replication_password: "{{ patroni_replication_password }}"

with_haproxy_load_balancing: true

patroni_etcd_username: "etcd-user"
patroni_etcd_password: "{{ patroni_etcd_password }}"
patroni_etcd_protocol: "https"

postgresql_users:
  - { name: "{{ pgbouncer_auth_username }}", password: "{{ pgbouncer_auth_password }}", flags: "LOGIN", role: "" }
  - { name: "monitoring", password: "{{ monitoring_password }}", flags: "LOGIN", role: "pg_monitor" } # monitoring Service Account
  - { name: "db-user", password: "{{ db_user_password }}", flags: "NOSUPERUSER" }

postgresql_databases:
  - { db: "test-db", encoding: "UTF8", lc_collate: "en_US.UTF-8", lc_ctype: "en_US.UTF-8", owner: "db-user" }

postgresql_parameters:
  - { option: "max_connections", value: "300" }
  - { option: "maintenance_work_mem", value: "1536MB" }
  - { option: "huge_pages", value: "off" }
  - { option: "max_worker_processes", value: "12" }
  - { option: "max_parallel_workers", value: "12" }
  - { option: "max_parallel_workers_per_gather", value: "4" }
  - { option: "max_parallel_maintenance_workers", value: "4" }

postgresql_pg_hba:
  - { type: "local", database: "all", user: "{{ patroni_superuser_username }}", address: "", method: "trust" }
  - { type: "local", database: "all", user: "{{ pgbouncer_auth_username }}", address: "", method: "trust" } # required for pgbouncer auth_user
  - { type: "local", database: "replication", user: "{{ patroni_superuser_username }}", address: "", method: "trust" }
  - { type: "local", database: "all", user: "all", address: "", method: "{{ postgresql_password_encryption_algorithm }}" }
  - { type: "host", database: "all", user: "all", address: "127.0.0.1/32", method: "{{ postgresql_password_encryption_algorithm }}" }
  - { type: "host", database: "all", user: "all", address: "::1/128", method: "{{ postgresql_password_encryption_algorithm }}" }
  - { type: "host", database: "all", user: "db-user", address: "172.16.47.0/26", method: "{{ postgresql_password_encryption_algorithm }}" }

ntp_enabled: true

locale_gen:
  - { language_country: "en_US", encoding: "UTF-8" }
  - { language_country: "ru_RU", encoding: "UTF-8" }

swap_file_create: false
sysctl_set: false
ls -lha /var/log/postgresql/
total 8.0K
drwx------  2 postgres postgres 4.0K Jul 31 10:48 .
drwxr-xr-x 14 root     root     4.0K Jul 31 10:48 ..
vitabaks commented 1 month ago

Hi @xRTRx

I see that you have redefined postgresql_parameters and there are not many parameters that I set by default, including the log_directory option

Check the current value set in your database (in psql)

show log_directory;
xRTRx commented 1 month ago
postgres=# show log_directory;
 log_directory 
---------------
 log
(1 row)
vitabaks commented 1 month ago

Well then your logs are on the path pgdata/log

Or set the log_directory parameter as in my example.

xRTRx commented 1 month ago

There is no pgdata directory. find / -name pgdata The output is empty.

vitabaks commented 1 month ago

To check the current PGDATA

show data_directory;