Configuring log rotation for PostgreSQL log files in VMware vCenter Server Appliance
search cancel

Configuring log rotation for PostgreSQL log files in VMware vCenter Server Appliance

book

Article ID: 338104

calendar_today

Updated On:

Products

VMware vCenter Server

Issue/Introduction

This article provides steps to configure log rotation for the embedded PostgreSQL database in vCenter Server Appliance

Environment

VMware vCenter Server Appliance 5.5.x
VMware vCenter Server Appliance 6.x
VMware vCenter Server Appliance 7.x
VMware vCenter Server Appliance 8.x

Resolution

Perform these steps to configure log rotation for the embedded PostgreSQL database:

  1. Connect to the VCSA through SSH
  2. Run this command to stop the vCenter service:

    /etc/init.d/vmware-vpxd stop

  3. Run this command to stop the PostgreSQL service:

    /etc/init.d/vmware-vpostgres stop

  4. Run this command to change the directory to /storage/db/vpostgres/:

    cd /storage/db/vpostgres/

  5. Open the postgresql.conf file with vi:

    vi postgresql.conf

  6. Find the ERROR REPORTING AND LOGGING section and change these lines:

    #log_directory = 'pg_log'
    #log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log'
    #log_truncate_on_rotation = off
    #log_rotation_age = 1d


    to

    log_directory = 'pg_log'
    log_filename = 'postgresql-%d.log'
    log_truncate_on_rotation = on
    log_rotation_age = 1440


  7. Run this command to start the PostgreSQL service:

    /etc/init.d/vmware-vpostgres start

  8. Run this command to start the vCenter service:

    /etc/init.d/vmware-vpxd start


Additional Information