Book Image

PostgreSQL Cookbook

By : Chitij Chauhan
Book Image

PostgreSQL Cookbook

By: Chitij Chauhan

Overview of this book

<p>PostgreSQL is an open source database management system. It is used for a wide variety of development practices such as software and web design, as well as for handling large datasets (big data).</p> <p>With the goal of teaching you the skills to master PostgreSQL, the book begins by giving you a glimpse of the unique features of PostgreSQL and how to utilize them to solve real-world problems. With the aid of practical examples, the book will then show you how to create and manage databases. You will learn how to secure PostgreSQL, perform administration and maintenance tasks, implement high availability features, and provide replication. The book will conclude by teaching you how to migrate information from other databases to PostgreSQL.</p>
Table of Contents (19 chapters)
PostgreSQL Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Maintaining log files


The information stored in log files can prove invaluable when diagnosing or troubleshooting problems. With the help of the information stored in the log files, you can identify the sources of the problems in the underlying database. For this very reason, it is important to preserve log files rather than discarding them. However, the information in the log files tends to be voluminous, so it important that a rotation policy be implemented in order to preserve certain log files and to discard log files that are no longer required. Log files need to be rotated so that new log files are started and old ones are removed after a reasonable period of time.

How to do it...

There are various mechanisms through which logging information is maintained and preserved in log files. These are discussed as follows:

  • One way to deal with this is to send the server's stderr output to some kind of log rotation program. PostgreSQL has a built-in log rotation facility, which can be used by...