vCenter Server vPostgres log rotation fails due to missing vmware_postgres_log and vmware_vtsdb_postgres_log after updating to vCenter 8.0U3g
search cancel

vCenter Server vPostgres log rotation fails due to missing vmware_postgres_log and vmware_vtsdb_postgres_log after updating to vCenter 8.0U3g

book

Article ID: 407509

calendar_today

Updated On:

Products

VMware vCenter Server 8.0

Issue/Introduction

Symptoms:


Logs stop rotating for the following logs 

  • /var/log/vmware/vpostgres/postgresql.log
  • /var/log/vmware/vtsdb/postgresql.log

/storage/log partition will be 100% full leading to log disk exhaustion. 

Environment

vCenter 8.0U3g

 

Cause

  • After upgrading vCenter to 8.0U3g, files vmware_postgres_log and vmware_vtsdb_postgres_log have been merged into file /etc/logrotate.d/vmware-additional-data.lr
  • Log rotation was not working as expected due to "postgresql.log" not being specified correctly.

 

This leads to log files to stop being rotated and eventually fill up the /storage/log partition.

Resolution

Workaround:


Using vi or other editor create the following files:

Add the below entry /var/log/vmware/vpostgres/postgresql.log  in file /etc/logrotate.d/vmware-additional-data.lr in line number 257.

 

# From `vmware_postgres_log.lr`

/var/log/vmware/vpostgres/postgresql.log

/var/log/vmware/vpostgres/postgresql-%d.log
{
    rotate 30
    firstaction
        dim=$(date -d "$(date +%Y-%m-01) +1 month -1 day" +%d)
        find /var/log/vmware/vpostgres/ -name "postgresql.log-*gz" -mtime +$dim -exec rm {} \;
    endscript
    daily
    maxage 30
    dateext
    dateyesterday
    dateformat -%Y-%m-%d_%H:%M:%S
    compress
}

 

Note: No other action should be needed as the cron job will run every hour. 
 
Note: If "postgresql.log" has already grown to +20gb, you will need to zero out the file in order for log rotation to work. 
>/var/log/vmware/vpostgres/postgresql.log
 

Additional Information