Enable timestamp in postgres logs

Follow

Problem

In Eucalyptus 3.x the postgres database logs do not show a timestamp for messages. This makes it difficult to be able to determine the time in which an error has occurred within the postgresql (/var/log/eucalyptus/postgres*) log files on the CLC. 

Resolution

Edit the postgres configuration file on the CLC /var/lib/eucalyptus/db/data/postgresql.conf

In line no 377 (in default configuration file) you would find:
#log_line_prefix = # special values:

uncomment the parameter in this file "log_line_prefix" and set the value to '%t' like this:

log_line_prefix = '%t' # special values:

Then restart eucalyptus-cloud service on the CLC.  Note that this will cause service downtime!

service eucalyptus-cloud restart

Done!

Now if you go and check the postgres log files in /var/log/eucalyptus they will have timestamps like this:

2014-03-04 10:17:42 PSTERROR: database "eucalyptus_loadbalancing" already exists

2014-03-04 10:17:42 PSTSTATEMENT: CREATE DATABASE eucalyptus_loadbalancing OWNER eucalyptus

2014-03-04 10:17:42 PSTERROR: database "eucalyptus_walrus" already exists

2014-03-04 10:17:42 PSTSTATEMENT: CREATE DATABASE eucalyptus_walrus OWNER eucalyptus

2014-03-04 10:17:42 PSTERROR: database "eucalyptus_dns" already exists


By default, timestamp in postgres log will be enabled in eucalyptus 4.0 [1]

References

[1] https://eucalyptus.atlassian.net/browse/EUCA-8835

Have more questions? Submit a request

Comments

Powered by Zendesk