Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you enable the logging of all queries to postgreSQL AWS RDS instance?

I want to monitor all queries to my postgresql instance. Following these steps, I created a custom db parameter group, set log_statement to all and log_min_duration_statement to 1, applied the parameter group to my instance, and rebooted it. Then I fired a POST request to the instance but a record of query wasn't to be found in the Recent Events & Logs tab of my instance. Doing a SELECT * FROM table query in psql however shows that the resource was created and the post request worked. What am I missing in order to see the logs?

like image 353
photon Avatar asked Jul 10 '15 00:07

photon


2 Answers

Setting log_min_duration_statement to 1 tells Postgres to only log queries that take longer than 1 ms. If you set it to 0 instead, all queries will be logged (the default, no logging, is -1).

like image 150
Luke Sedney Avatar answered Oct 09 '22 22:10

Luke Sedney


You followed the right steps, all that is left is to make sure the parameter group is properly applied to your Postgres instance. Look at the Parameter Group in the Configuration Details tab of your instance, and make sure they have the right group name followed by "in-sync". A reboot is usually required when changing parameter groups on an instance, this may be what is (was?) missing in your case.

like image 45
Anton Drukh Avatar answered Oct 09 '22 23:10

Anton Drukh