Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
PostgreSQL Administration Essentials

You're reading from   PostgreSQL Administration Essentials Discover efficient ways to administer, monitor, replicate, and handle your PostgreSQL databases

Arrow left icon
Product type Paperback
Published in Oct 2014
Publisher Packt
ISBN-13 9781783988983
Length 142 pages
Edition 1st Edition
Languages
Arrow right icon
Toc

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...

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 $19.99/month. Cancel anytime