First of all, make sure that pgprtdbg
is installed and in your path by
using pgprtdbg -?
. You should see
pgprtdbg 0.4.0
PostgreSQL protocol debugging
Usage:
pgprtdbg [ -c CONFIG_FILE ] [ -d ]
Options:
-c, --config CONFIG_FILE Set the path to the pgprtdbg.conf file
-d, --daemon Run as a daemon
-V, --version Display version information
-?, --help Display help
If you don't have pgprtdbg
in your path see README on how to
compile and install pgprtdbg
in your system.
Lets create a simple configuration file called pgprtdbg.conf
with the content
[pgprtdbg]
host = localhost
port = 2346
output = pgprtdbg.out
log_type = console
log_level = info
log_path =
[primary]
host = localhost
port = 5432
In our main section called [pgprtdbg]
we setup pgprtdbg
to listen on all
network addresses on port 2346. Logging will be performed at info
level and
sent to the console. The output of pgprtdbg
is sent to the pgprtdbg.out
file.
Next we create a section called [primary]
which has the information about our
PostgreSQL instance. In this case it is running
on localhost
on port 5432
.
We are now ready to run pgprtdbg
.
See Configuration for all configuration options.
We will run pgprtdbg
using the command
pgprtdbg -c pgprtdbg.conf
If this doesn't give an error, then we are ready to connect.
We will assume that we have a user called test
with the password test
in our
PostgreSQL instance. See their
documentation on how to setup
PostgreSQL, add a user
and add a database.
We will connect to pgprtdbg
using the psql
application.
psql -h localhost -p 2346 -U test test
That should give you a password prompt where test
should be typed in. You are now connected
to PostgreSQL through pgprtdbg
.
pgprtdbg
will log the protocol interactions in the file pgprtdbg.out
. The format of the output
file is based on the actual message format type, but has the prefix of
[C|S],<COMMAND>
where C
is client, and S
is the server. The <COMMAND>
is the message type identifier found in the
specification.
pgprtdbg
is stopped by pressing Ctrl-C (^C
) in the console where you started it, or by sending
the SIGTERM
signal to the process using kill <pid>
.
The pgprtdbg community hopes that you find the project interesting.
Feel free to
All contributions are most welcome !