logging connections

Started by surabhi.ahujaabout 20 years ago4 messagesgeneral
Jump to latest
#1surabhi.ahuja
surabhi.ahuja@iiitb.ac.in

i want to know, how i can log connections to postgres.

the sample log file is:
LOG: shutting down
LOG: database system is shut down
LOG: database system was shut down at 2006-01-17 18:18:24 CST
LOG: checkpoint record is at 0/B035D0
LOG: redo record is at 0/B035D0; undo record is at 0/0; shutdown TRUE
LOG: next transaction ID: 1267; next OID: 17728
LOG: database system is ready
LOG: unexpected EOF on client connection
LOG: unexpected EOF on client connection
LOG: unexpected EOF on client connection
LOG: received fast shutdown request
LOG: aborting any active transactions
FATAL: terminating connection due to administrator command
LOG: shutting down
LOG: database system is shut down
LOG: database system was shut down at 2006-01-20 11:00:00 CST
LOG: checkpoint record is at 0/3C339CB4
LOG: redo record is at 0/3C339CB4; undo record is at 0/0; shutdown TRUE
LOG: next transaction ID: 2283381; next OID: 1159413
LOG: database system is ready
LOG: unexpected EOF on client connection
LOG: unexpected EOF on client connection
LOG: unexpected EOF on client connection
LOG: unexpected EOF on client connection
LOG: unexpected EOF on client connection

however, i am still not able to know how to log into the above file,
who has connected etc

if i can log something like " LOG: connection received: host=client1

port=3775"

and also if i shut down postmaster, using pg_ctl stop, no logging takes place to the above log file.

How to enable the above,

thanks,
regards
Surabhi

-----Original Message-----
From: pgsql-general-owner@postgresql.org on behalf of Tom Lane
Sent: Fri 1/20/2006 3:13 AM
To: Nik
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] Connections not closing

***********************
Your mail has been scanned by iiitb VirusWall.
***********-***********

"Nik" <XLPizza@gmail.com> writes:

Ok, I simplified the problem. I tried just running psql from the
command line, and I noticed that it opens two connection on two
different ports, and it closes only one.
For example I do the following in the command prompt:

C:\> psql -h host_name -p 5432 -d db_name -U user_name
Password:

2006-01-19 09:50:29 [unknown] LOG: connection received: host=client1
port=3775

2006-01-19 09:50:31 [unknown] LOG: connection received: host=client1
port=3778

2006-01-19 09:50:31 test LOG: connection authorized: user=user_name
database=db_name

It tries to connect, gets told it needs a password (the log verbosity
level is not high enough to record the rejection), asks you for the
password, and connects again. I don't see anything funny here.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

#2Nik
XLPizza@gmail.com
In reply to: surabhi.ahuja (#1)
Re: logging connections

You need to edit your postgresql.conf file and in the "Error reporting and
logging" section set "log_connections=true", "log_disconnections=true", and
"log_hostname=true"

Show quoted text

On 1/20/06, surabhi.ahuja <surabhi.ahuja@iiitb.ac.in> wrote:

i want to know, how i can log connections to postgres.

the sample log file is:
LOG: shutting down
LOG: database system is shut down
LOG: database system was shut down at 2006-01-17 18:18:24 CST
LOG: checkpoint record is at 0/B035D0
LOG: redo record is at 0/B035D0; undo record is at 0/0; shutdown TRUE
LOG: next transaction ID: 1267; next OID: 17728
LOG: database system is ready
LOG: unexpected EOF on client connection
LOG: unexpected EOF on client connection
LOG: unexpected EOF on client connection
LOG: received fast shutdown request
LOG: aborting any active transactions
FATAL: terminating connection due to administrator command
LOG: shutting down
LOG: database system is shut down
LOG: database system was shut down at 2006-01-20 11:00:00 CST
LOG: checkpoint record is at 0/3C339CB4
LOG: redo record is at 0/3C339CB4; undo record is at 0/0; shutdown TRUE
LOG: next transaction ID: 2283381; next OID: 1159413
LOG: database system is ready
LOG: unexpected EOF on client connection
LOG: unexpected EOF on client connection
LOG: unexpected EOF on client connection
LOG: unexpected EOF on client connection
LOG: unexpected EOF on client connection

however, i am still not able to know how to log into the above file,
who has connected etc

if i can log something like " LOG: connection received: host=client1

port=3775"

and also if i shut down postmaster, using pg_ctl stop, no logging takes
place to the above log file.

How to enable the above,

thanks,
regards
Surabhi

-----Original Message-----
From: pgsql-general-owner@postgresql.org on behalf of Tom Lane
Sent: Fri 1/20/2006 3:13 AM
To: Nik
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] Connections not closing

***********************
Your mail has been scanned by iiitb VirusWall.
***********-***********

"Nik" <XLPizza@gmail.com> writes:

Ok, I simplified the problem. I tried just running psql from the
command line, and I noticed that it opens two connection on two
different ports, and it closes only one.
For example I do the following in the command prompt:

C:\> psql -h host_name -p 5432 -d db_name -U user_name
Password:

2006-01-19 09:50:29 [unknown] LOG: connection received: host=client1
port=3775

2006-01-19 09:50:31 [unknown] LOG: connection received: host=client1
port=3778

2006-01-19 09:50:31 test LOG: connection authorized: user=user_name
database=db_name

It tries to connect, gets told it needs a password (the log verbosity
level is not high enough to record the rejection), asks you for the
password, and connects again. I don't see anything funny here.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

#3surabhi.ahuja
surabhi.ahuja@iiitb.ac.in
In reply to: Nik (#2)
Re: logging connections

i did the above, however still no looging is being done.

for eg if i have a c++ program where i establish a connection to postgres and does some activity.

the postgres log should log the above connection to postgres when i run the program.

similarly say if i do psql database_name

this is also another connection, and shd get logged.

however by the changes u suggested, i am not able to do so.

thanks,
reagrds

surabhi

-----Original Message-----
From: pgsql-general-owner@postgresql.org on behalf of Nikola Ivanov
Sent: Fri 1/20/2006 7:41 PM
To: surabhi.ahuja
Cc: Tom Lane; pgsql-general@postgresql.org
Subject: Re: [GENERAL] logging connections

***********************
Your mail has been scanned by iiitb VirusWall.
***********-***********

You need to edit your postgresql.conf file and in the "Error reporting and
logging" section set "log_connections=true", "log_disconnections=true", and
"log_hostname=true"

Show quoted text

On 1/20/06, surabhi.ahuja <surabhi.ahuja@iiitb.ac.in> wrote:

i want to know, how i can log connections to postgres.

the sample log file is:
LOG: shutting down
LOG: database system is shut down
LOG: database system was shut down at 2006-01-17 18:18:24 CST
LOG: checkpoint record is at 0/B035D0
LOG: redo record is at 0/B035D0; undo record is at 0/0; shutdown TRUE
LOG: next transaction ID: 1267; next OID: 17728
LOG: database system is ready
LOG: unexpected EOF on client connection
LOG: unexpected EOF on client connection
LOG: unexpected EOF on client connection
LOG: received fast shutdown request
LOG: aborting any active transactions
FATAL: terminating connection due to administrator command
LOG: shutting down
LOG: database system is shut down
LOG: database system was shut down at 2006-01-20 11:00:00 CST
LOG: checkpoint record is at 0/3C339CB4
LOG: redo record is at 0/3C339CB4; undo record is at 0/0; shutdown TRUE
LOG: next transaction ID: 2283381; next OID: 1159413
LOG: database system is ready
LOG: unexpected EOF on client connection
LOG: unexpected EOF on client connection
LOG: unexpected EOF on client connection
LOG: unexpected EOF on client connection
LOG: unexpected EOF on client connection

however, i am still not able to know how to log into the above file,
who has connected etc

if i can log something like " LOG: connection received: host=client1

port=3775"

and also if i shut down postmaster, using pg_ctl stop, no logging takes
place to the above log file.

How to enable the above,

thanks,
regards
Surabhi

-----Original Message-----
From: pgsql-general-owner@postgresql.org on behalf of Tom Lane
Sent: Fri 1/20/2006 3:13 AM
To: Nik
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] Connections not closing

***********************
Your mail has been scanned by iiitb VirusWall.
***********-***********

"Nik" <XLPizza@gmail.com> writes:

Ok, I simplified the problem. I tried just running psql from the
command line, and I noticed that it opens two connection on two
different ports, and it closes only one.
For example I do the following in the command prompt:

C:\> psql -h host_name -p 5432 -d db_name -U user_name
Password:

2006-01-19 09:50:29 [unknown] LOG: connection received: host=client1
port=3775

2006-01-19 09:50:31 [unknown] LOG: connection received: host=client1
port=3778

2006-01-19 09:50:31 test LOG: connection authorized: user=user_name
database=db_name

It tries to connect, gets told it needs a password (the log verbosity
level is not high enough to record the rejection), asks you for the
password, and connects again. I don't see anything funny here.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

#4surabhi.ahuja
surabhi.ahuja@iiitb.ac.in
In reply to: surabhi.ahuja (#3)
Re: logging connections

please clarify the following:

log_destination (string)
PostgreSQL supports several methods for logging server messages, including stderr and syslog. On Windows, eventlog is also supported. Set this option to a list of desired log destinations separated by commas. The default is to log to stderr only. This option can only be set at server start or in the postgresql.conf configuration file.

can u please tell what do "stderr" and "syslog" mean?

thanks,
regards
Surabhi Ahuja

-----Original Message-----
From: pgsql-general-owner@postgresql.org on behalf of surabhi.ahuja
Sent: Mon 1/23/2006 2:04 PM
To: Nikola Ivanov
Cc: Tom Lane; pgsql-general@postgresql.org
Subject: Re: [GENERAL] logging connections

***********************
Your mail has been scanned by iiitb VirusWall.
***********-***********

i did the above, however still no looging is being done.

for eg if i have a c++ program where i establish a connection to postgres and does some activity.

the postgres log should log the above connection to postgres when i run the program.

similarly say if i do psql database_name

this is also another connection, and shd get logged.

however by the changes u suggested, i am not able to do so.

thanks,
reagrds

surabhi

-----Original Message-----
From: pgsql-general-owner@postgresql.org on behalf of Nikola Ivanov
Sent: Fri 1/20/2006 7:41 PM
To: surabhi.ahuja
Cc: Tom Lane; pgsql-general@postgresql.org
Subject: Re: [GENERAL] logging connections

***********************
Your mail has been scanned by iiitb VirusWall.
***********-***********

You need to edit your postgresql.conf file and in the "Error reporting and
logging" section set "log_connections=true", "log_disconnections=true", and
"log_hostname=true"

Show quoted text

On 1/20/06, surabhi.ahuja <surabhi.ahuja@iiitb.ac.in> wrote:

i want to know, how i can log connections to postgres.

the sample log file is:
LOG: shutting down
LOG: database system is shut down
LOG: database system was shut down at 2006-01-17 18:18:24 CST
LOG: checkpoint record is at 0/B035D0
LOG: redo record is at 0/B035D0; undo record is at 0/0; shutdown TRUE
LOG: next transaction ID: 1267; next OID: 17728
LOG: database system is ready
LOG: unexpected EOF on client connection
LOG: unexpected EOF on client connection
LOG: unexpected EOF on client connection
LOG: received fast shutdown request
LOG: aborting any active transactions
FATAL: terminating connection due to administrator command
LOG: shutting down
LOG: database system is shut down
LOG: database system was shut down at 2006-01-20 11:00:00 CST
LOG: checkpoint record is at 0/3C339CB4
LOG: redo record is at 0/3C339CB4; undo record is at 0/0; shutdown TRUE
LOG: next transaction ID: 2283381; next OID: 1159413
LOG: database system is ready
LOG: unexpected EOF on client connection
LOG: unexpected EOF on client connection
LOG: unexpected EOF on client connection
LOG: unexpected EOF on client connection
LOG: unexpected EOF on client connection

however, i am still not able to know how to log into the above file,
who has connected etc

if i can log something like " LOG: connection received: host=client1

port=3775"

and also if i shut down postmaster, using pg_ctl stop, no logging takes
place to the above log file.

How to enable the above,

thanks,
regards
Surabhi

-----Original Message-----
From: pgsql-general-owner@postgresql.org on behalf of Tom Lane
Sent: Fri 1/20/2006 3:13 AM
To: Nik
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] Connections not closing

***********************
Your mail has been scanned by iiitb VirusWall.
***********-***********

"Nik" <XLPizza@gmail.com> writes:

Ok, I simplified the problem. I tried just running psql from the
command line, and I noticed that it opens two connection on two
different ports, and it closes only one.
For example I do the following in the command prompt:

C:\> psql -h host_name -p 5432 -d db_name -U user_name
Password:

2006-01-19 09:50:29 [unknown] LOG: connection received: host=client1
port=3775

2006-01-19 09:50:31 [unknown] LOG: connection received: host=client1
port=3778

2006-01-19 09:50:31 test LOG: connection authorized: user=user_name
database=db_name

It tries to connect, gets told it needs a password (the log verbosity
level is not high enough to record the rejection), asks you for the
password, and connects again. I don't see anything funny here.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly