Database connection log

Started by Tiffany Thangalmost 8 years ago3 messagesgeneral
Jump to latest
#1Tiffany Thang
tiffanythang@gmail.com

Hi,
Does PostgreSQL keep a log of client connections to the database like
Oracle's listener.log? I would like to extract information such as how many
connections are made to the database daily, the IP addresses they
originated from and the schemas they are connected to. Would it be possible
to extract the above information in PostgreSQL?

Thanks.

#2Christoph Moench-Tegeder
cmt@burggraben.net
In reply to: Tiffany Thang (#1)
Re: Database connection log

## Tiffany Thang (tiffanythang@gmail.com):

Does PostgreSQL keep a log of client connections to the database like
Oracle's listener.log? I would like to extract information such as how many
connections are made to the database daily, the IP addresses they
originated from and the schemas they are connected to. Would it be possible
to extract the above information in PostgreSQL?

Set "log_connections" to "on":
https://www.postgresql.org/docs/10/static/runtime-config-logging.html#RUNTIME-CONFIG-LOGGING-WHAT

Regards,
Christoph

--
Spare Space

#3Pierre Timmermans
ptim007@yahoo.com
In reply to: Tiffany Thang (#1)
Re: Database connection log

I believe that you can achieve what you want with the following configuration parameters: log_connections and log_line_prefix 
PostgreSQL: Documentation: 10: 19.8. Error Reporting and Logging

|
|
|
| | |

|

|
|
| |
PostgreSQL: Documentation: 10: 19.8. Error Reporting and Logging

|

|

|

Regards, Pierre

On Thursday, June 14, 2018, 4:48:54 PM GMT+2, Tiffany Thang <tiffanythang@gmail.com> wrote:

Hi,Does PostgreSQL keep a log of client connections to the database like Oracle's listener.log? I would like to extract information such as how many connections are made to the database daily, the IP addresses they originated from and the schemas they are connected to. Would it be possible to extract the above information in PostgreSQL?
Thanks.