Smarts NCM: How to clean up space consumed by postgres logs in the <VOYENCE_HOME>/db/controldb/data/pg_log
search cancel

Smarts NCM: How to clean up space consumed by postgres logs in the <VOYENCE_HOME>/db/controldb/data/pg_log

book

Article ID: 303524

calendar_today

Updated On:

Products

VMware

Issue/Introduction

Symptoms:


How to clean up space consumed in Smarts Network Configuration Manager (Smarts NCM) environment by postgres logs in the <VOYENCE_HOME>/db/controldb/data/pg_log directory?
How to clean up logs created by postgres in Smarts NCM environment?


Smarts NCM <VOYENCE_HOME> directory is nearly full
Smarts NCM <VOYENCE_HOME>/db/controldb/data/pg_log directory is nearly full

Environment

VMware Smart Assurance - NCM

Cause

Postgres generates human readable log files generated for debugging and auditing purposes. These logs contain what they are configured to contain, and are often stored in pg_log, or in the system logs (/var/log/...)  depending on your configuration.

Resolution

If you encounter this issue, you must manually delete the logs from the pg_log directory.

Additional Information

Postgres does not have a automation utility to clean up these logs. If the desire is to automate this, a cron job could be used.

There are three directories in a default $PGDATA directory when you create it which are named "pg_*log".

  • $PGDATA/pg_log is the default location for the database activity logs, which include error messages, query logging, and startup/shutdown messages
    • You can freely delete, rename, compress, and move files in pg_log without penalty, as long as the postgres user still has rights to write to the directory.
  • $PGDATA/pg_xlog is the PostgreSQL transaction log.
    • Deleting pg_xlog files may result in irrecoverable database corruption.
  • $PGDATA/pg_clog contains a log of transaction metadata.
    • Should you ever delete files from pg_clog, you might as well delete the entire database directory.  There is no recovery from a missing clog.