How to Change PostgreSQL Log Format on CentOS 6.2

Share this Article :

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

Also Read :   How To Exclude Posts Category from Homepage in Thesis Theme

1. Open the PostgreSQL configuration file :

[[email protected] ~]# 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 :

[[email protected] ~]# /etc/rc.d/init.d/postgresql restart
Stopping postgresql service:                               [  OK  ]
Starting postgresql service:                               [  OK  ]

Leave a Reply