Search icon
Subscription
0
Cart icon
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
PostgreSQL Administration Essentials

You're reading from  PostgreSQL Administration Essentials

Product type Book
Published in Oct 2014
Publisher Packt
ISBN-13 9781783988983
Pages 142 pages
Edition 1st Edition
Languages

Making log creation more fine grained


Until now, you learned how to configure logs on a per-instance basis. We changed parameters in postgresql.conf globally, and we enjoyed the fact that logging was easy and fast.

However, in some cases, we might want to be a bit more fine grained and more specific about what has to be logged and what can go unnoticed.

Logging selectively

PostgreSQL provides us with some instructions that allow us to set variables (work_mem, time_zone, logging related stuff, and so on) on a per-database basis. This can come in handy if you want to be a bit more selective. Here is how you can change logging for an entire database in your database instance:

test=# ALTER DATABASE test SET log_statement = 'all';
ALTER DATABASE

Of course, we can also do this for a user. The syntax works like this:

ALTER ROLE name [ IN DATABASE database_name ]
   SET configuration_parameter { TO | = }
      { value | DEFAULT }

The following example shows how we can make the hs user in the test database...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}