-
(log_connection)
Causes each attempted connection to the server to be logged, as well as successful completion of client authentication. Only superusers can change this parameter at session start, and it cannot be changed at all within a session. The default is off
(log_destination)
PostgreSQL supports several methods for logging server messages, including stderr, csvlog and syslog. On Windows, eventlog is also supported. Set this parameter to a list of desired log destinations separated by commas. The default is to log to stderr only. This parameter can only be set in the file or on the server command line.
If csvlog is included in , log entries are output in “comma separated value” (CSV) format, which is convenient for loading logs into programs. See for details. must be enabled to generate CSV-format log output.
When either stderr or csvlog are included, the file is created to record the location of the log file(s) currently in use by the logging collector and the associated logging destination. This provides a convenient way to find the logs currently in use by the instance. Here is an example of this file's content:
-
log_connections e log_disconnections: Faz com que cada conexão e desconexão de um usuário seja logada. Se você tem muitas conexões entrando e saindo com frequência, isso pode ser irritante, pois serão milhares de mensagens de log.
log_destination: Aqui você pode escolher entre stderr, csvlog, syslog e se estiver utilizando o Windows, eventlog. O uso do syslog ou do eventlog faz com que os logs sejam direcionados para o destino padrão dos logs no seu sistema operacional.
Fonte: https://www.savepoint.blog.br/2015/01/20/trabalhando-com-logs-no-postgresql/
-
✅Gabarito(Certo)
Essa mesma configuração pode ser feita no arquivo de configuração "postgresql.conf".
The following is an example of some configuration parameter settings in the postgresql.conf file:
# This is a comment
log_connections = yes
log_destination = 'syslog'
search_path = '"$user", public'
shared_buffers = 128MB
Fonte: https://www.enterprisedb.com/edb-docs/d/edb-postgres-advanced-server/user-guides/user-guide/11/EDB_Postgres_Advanced_Server_Guide.1.21.html