T
T
tiqq2018-10-18 14:54:18
PostgreSQL
tiqq, 2018-10-18 14:54:18

Postgresql - how to enable query logging?

Hello. It costs ubuntu 16.04. I'm trying to enable request logging as described here . After the steps taken, it says to look for logs here "/var/lib/pgsql/9.6/data/pg_log/", but I don't have a pgsql folder, but there is postgresql, there is no data folder in the 9.6 folder, there is only a main folder, but in the folder main also has no data folder and no pg_log folder. For every screen of the contents of the main folder is attached. Question - where to look for logs?5bc87466861b0602660685.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Melkij, 2018-10-18
@tiqq

rpm-based (redhat, centos) and deb-based (debian, ubuntu) install postgresql in different ways. So the details are different.
PGDATA like /var/lib/pgsql/9.6/data/ is typical for centos. The database config is here.
ubuntu cluster by default put in /var/lib/postgresql/9.6/main/
Logs in ubuntu by default will be written in /var/log/postgresql/postgresql-9.6-main.log , and config - in /etc/postgresql/9.6 /main/postgresql.conf
In general, there are two questions here:
find where the base logs are written or change the settings so that the logs are written where you want. This has nothing to do with enabling query logging, this is where the logs are in general. If you have a reason to change the logging location settings, then you should already know why.
enable request logging: the log_min_duration_statement setting allows logging requests longer than the specified time (0 - all requests) or log_statement logging everything of the specified type (for example, all DDL
) pg_basebackup, where, in general, they have absolutely nothing to do and no reason to.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question