Ricardo Adam
Ricardo Adam

Reputation: 115

Statement enabling in Yugabyte YSQL

I want to see all the YSQL statements that are being executed. Something like log_statement=all in postgres. How do I enable statement logging in Yugabyte YSQL?

Upvotes: 2

Views: 131

Answers (1)

Fizaa
Fizaa

Reputation: 96

If you're running a local cluster, cd into your data directory and find the file postgresql.conf in node-1/disk-1/pg_data. You can change the value of the log_statement parameter here (and uncomment it). The valid values for this field are none,ddl,mod and all (like in Postgres). This will modify logging for the node-1.
You can similarly change the logging behavior for the other nodes.
For the changes to take effect, restart the cluster using ./bin/yb-ctl restart.
By default, the logs are in postgresql-%Y-%m-%d_%H%M%S.log located in node-1/disk-1/yb-data/tserver/logs (for node-1). You can change the log_filename inside postgresql.conf as well.

If you're running a distributed cluster, locate the pg_data directory on your node, edit the postgresql.conf file as above and then restart the cluster.

Hope this helps!

Upvotes: 3

Related Questions