File tree 2 files changed +24
-1
lines changed
2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
10
10
11
11
For a steady stream of TILs, [ sign up for my newsletter] ( https://crafty-builder-6996.ck.page/e169c61186 ) .
12
12
13
- _ 1179 TILs and counting..._
13
+ _ 1180 TILs and counting..._
14
14
15
15
---
16
16
@@ -595,6 +595,7 @@ _1179 TILs and counting..._
595
595
- [ Get The Size Of An Index] ( postgres/get-the-size-of-an-index.md )
596
596
- [ Getting A Slice Of An Array] ( postgres/getting-a-slice-of-an-array.md )
597
597
- [ Group By The Result Of A Function Call] ( postgres/group-by-the-result-of-a-function-call.md )
598
+ - [ Include All Queries In The Log File] ( postgres/include-all-queries-in-the-log-file.md )
598
599
- [ Insert A Bunch Of Records With Generate Series] ( postgres/insert-a-bunch-of-records-with-generate-series.md )
599
600
- [ Insert Just The Defaults] ( postgres/insert-just-the-defaults.md )
600
601
- [ Install Postgres With uuid-ossp Using asdf] ( postgres/install-postgres-with-uuid-ossp-using-asdf.md )
Original file line number Diff line number Diff line change
1
+ # Include All Queries In The Log File
2
+
3
+ The default log-level (` log_statement ` setting) for a PostgreSQL server is
4
+ ` none ` . Other valid log-levels for [ that setting are ` ddl ` , ` mod ` , and
5
+ ` all ` ] ( https://www.postgresql.org/docs/13/runtime-config-logging.html ) .
6
+
7
+ If you want to see all the queries hitting a database, you'll want to set it to
8
+ ` all ` . This can be set as a server-wide setting or it can be set on a
9
+ per-session basis.
10
+
11
+ Because ` all ` is so noisy, I like to use it on a per-session basis when I'm in
12
+ a situation where I know I'd like to see all queries.
13
+
14
+ ``` sql
15
+ > set log_statement = ' all' ;
16
+ ```
17
+
18
+ After running that statement in my ` psql ` session, I can tail the log file to
19
+ keep an eye on queries hitting the database.
20
+
21
+ Be sure that [ logging is enabled via the
22
+ ` logging_collector ` ] ( enable-logging-of-database-activity.md ) as well.
You can’t perform that action at this time.
0 commit comments