• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
sharadchhetri

sharadchhetri

Tutorials On Linux, Unix & Open Source

  • Home
  • Linux Commands
  • Resources
    • Learn Linux
  • My WordPress plugins

How to enable logging in Postgresql 9.2 and 9.1

December 8, 2013 by Sharad Chhetri Leave a Comment

In this post we will learn how to enable logging in Postgresql 9.2 and 9.1.It is a quick method to enable logging in Postgresql 9.2 and 9.1.We will do changes in postgresql.conf file.

Path in Postgresql 9.1 : /etc/postgresql/9.1/main/postgresql.conf
Path in Postgresql 9.2 : /etc/postgresql/9.2/main/postgresql.conf

To enable the log for all queries in Postgresql,follow the given below steps

Step 1: Take the backup of postgresql.conf file before editing.

In Postgresql 9.1

cp -p  /etc/postgresql/9.1/main/postgresql.conf  /etc/postgresql/9.1/main/postgresql.conf.orig

In Postgresql 9.2

cp -p  /etc/postgresql/9.2/main/postgresql.conf  /etc/postgresql/9.2/main/postgresql.conf.orig

Step 2: Now edit the postgresql.conf file .

For postgresql 9.1

vi /etc/postgresql/9.1/main/postgresql.conf

For postgresql 9.2

vi /etc/postgresql/9.2/main/postgresql.conf

Step 3:

Replace : #log_statement = 'none'
To : log_statement = ‘all’

Replace : #log_min_duration_statement = -1
To: log_min_duration_statement = 0

Save the file.

Step 4: Now restart the postgresql service

/etc/init.d/postgresql restart

Note: The path of log is
/var/log/postgresql/postgresql-9.1-main.log (In Postgresql 9.1)
/var/log/postgresql/postgresql-9.2-main.log (In Postgresql 9.2)

Share this:

  • Twitter
  • Facebook
  • More
  • Print
  • Email
  • LinkedIn
  • Reddit
  • Tumblr
  • Pinterest
  • Pocket
  • Telegram
  • WhatsApp
  • Mastodon

Related posts:

  1. How to enable logging of haproxy in rsyslog
  2. Show running process in postgresql
  3. How to set user postgres password in postgresql 9.1
  4. Install postgresql 9.4 on Ubuntu 14.04 LTS server
  5. Set postgres password on PostgreSQL 9.4
  6. Enable ethernet in RHEL 6.0 and CentOS 6.0 : Tested In Virtual Box and VMware
  7. Linux enable or disable multiple swap space
  8. How to enable su access or switch to superuser in freebsd
  9. Enable verbose mode while gem install of package
  10. Enable php5-imap on Ubuntu 14.04 LTS

Filed Under: Database Server Tagged With: postgresql

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Our Social Media Presence

  • Facebook
  • GitHub
  • Twitter

Linux Command

What is Linux Internal And External Command

Linux Basic Commands With Examples For Every Beginner

tr command to convert lines to space , tab and vertical tab

smbpasswd command not found on CentOS 7 and RHEL 7

Solution : semanage command not found

Unix / Linux : How to print duplicate lines from file

More Posts from this Category

You Might Like These Articles!

simplecodesyntax wordpress plugin

SimpleCodeSyntax : My Another WordPress Plugin

Install Nginx

How To Install Nginx On Ubuntu 22.04 LTS

Install Latest Git package in Ubuntu Operating System

How To Always Install Latest Git Package In Ubuntu Operating System

Bash script for installing VirtualBox on Ubuntu 22.04 LTS Desktop

Install VirtualBox On Ubuntu 22.04 LTS Desktop (Bash Script)

libfuse

dlopen(): error loading libfuse.so.2 – Got Error On Ubuntu

Failed to open/create the internal network

VirtualBox Error: Failed to open/create the internal network

Always Useful Tips And Tricks

curl command to check the http status

Recover Linux Grub Password in linux rescue mode CentOS/Red Hat

Run the script using nohup without hitting enter key two times

Nagios HTTP WARNING: HTTP/1.1 403 Forbidden

How to change smtp port number 25 in postfix

How to zip the directory in linux with command line

Error installing rails

Explore 90+ Article On "Linux Tips And Tricks"

Copyright © 2023 ยท
The material in this site cannot be republished either online or offline, without our permission.
Proudly Blogging From Bharat.

  • Contact
  • About Me
  • My WordPress plugins
  • Privacy Policy