How to Change PostgreSQL Log Format on CentOS 6.2

In this post, i will show the quick step to change log format for PostgreSQL on linux CentOS 6.2 server. PostgreSQL is a Sophisticated open-source Object-Relational DBMS supporting almost all SQL constructs, including subselects, transactions, and user-defined types. PostgreSQL is a powerful, open source object-relational database system that available for many platforms including Linux, FreeBSD, Solaris, Microsoft Windows and Mac OS X. Assumed that you have installed PostgreSQL database server on your CentOS 6.2 server

1. Open the PostgreSQL configuration file :

[root@centos62 ~]# vi /var/lib/pgsql/data/postgresql.conf

2. Go to line 334 and change log format as below :

log_line_prefix = '%t %u %d' 
#log_hostname = off
log_line_prefix = '%t %u %d'            # special values:
                                        #   %u = user name

3. Restart the PostgreSQL database server :

[root@centos62 ~]# /etc/rc.d/init.d/postgresql restart
Stopping postgresql service:                               [  OK  ]
Starting postgresql service:                               [  OK  ]
Leave a Reply

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

A world leading hosting company that provides fully-managed innovative and secure solutions, suitable for hosting small to medium-sized websites

Built on the best available technologies combined with Google Cloud for strong redundancy and application availability. Backed by skilled experts to address web security threats, a devops team to create advanced custom security solutions, and 24/7 sysadmins to watch over the platform. This powerful, hands-on approach makes your sites faster, safer, and easier to manage. Starting from only $3.95/mo.


* up to 30 days money back guarantee