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  ]

How to Configure PostgreSQL to Listen from Any IP Address on CentOS 6.2

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. In this post, i will show the quick steps on how to enable PostgreSQL to listen to all ip address on linux CentOS 6.2 server.

1. Open the PostgreSQL configuration file :

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

2. Go to line 59 and uncomment the line. Enable listen from any ip address as below. “*” is for all ip addresses :


#------------------------------------------------------------------------------
# CONNECTIONS AND AUTHENTICATION
#------------------------------------------------------------------------------

# - Connection Settings -

listen_addresses = '*'                 # what IP address(es) to listen on;
                                        # comma-separated list of addresses;
                                        # defaults to 'localhost', '*' = all

3. Restart the PostgreSQL database server :

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