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: 03-25-2025

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 7.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:

    service-control --stop vmware-vpxd 

  3. Run this command to stop the PostgreSQL service:

    service-control --stop vmware-vpostgres

  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 = '/var/log/vmware/vpostgres'
    #log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log'
    #log_truncate_on_rotation = off
    #log_rotation_age = 1d


    to

    log_directory = '/var/log/vmware/vpostgres'
    log_filename = 'postgresql-%d.log'
    log_truncate_on_rotation = on
    log_rotation_age = 1440


  7. Run this command to start the PostgreSQL service:

    service-control --start vmware-vpostgres

  8. Run this command to start the vCenter service:

    service-control --start vmware-vpxd 

 

Additional Information