How to rotate cs_data_cache-<day>.log and cs_repository_cache-<day>.log files in TIBCO DATA VIRTUALIZATION?

How to rotate cs_data_cache-<day>.log and cs_repository_cache-<day>.log files in TIBCO DATA VIRTUALIZATION?

book

Article ID: KB0071091

calendar_today

Updated On:

Products Versions
TIBCO Data Virtualization All Supported Versions

Description

We can see that log configuration settings are available in the postgresql.conf file for cs-data-cache-day-log-and-cs-repository-cache-day-log-files.

Modifying the postgresql.conf file under <TIBCO DATA VIRTUALIZATION installation dir>/TIBCO/repository/data will start rotating the cs-repository-cache-day-log files and postgresql.conf under <TIBCO DATA VIRTUALIZATION installation dir>/TIBCO/repository/data_cache will start rotating the cs-data-cache-day-log files.

However, we can notice that after inflating the desired log file size, these log files keep appending and do not rotate as mentioned in the log_rotation_size parameter which is inside the postgresql.conf file.

The log rotates based on age works well, but the sized-based rotation doesn't seem to work. The part we were missing here is log rotation log_truncate_on_rotation. However, truncation will occur only when a new file is opened due to time-based rotation, not during server startup or size-based rotation.

From the above, it is possible that Postgres will continue appending to the current log (i.e. regardless of the value of log_rotation_size) until the time-based setting tells Postgres that it is time to create a new log. Once a new log is created, it would stop appending to the current one and append to the new one instead.

Environment

All Supported Environments

Resolution

As we can see, the log is not rotated by size because it is not able to have a different name compared to the current log file. When we test it with a large log dump in a short time, we must include the count of seconds/minutes/hours  (%S/%M/%H) in the log file, and then it will rotate by size properly.

We only need to add these two configurations into the postgresql.conf file which is present inside <TIBCO DATA VIRTUALIZATION installation dir>/TIBCO/repository/data and <TIBCO DATA VIRTUALIZATION installation dir>/TIBCO/repository/data_cache:

    log_rotation_size = 100kB
    log_filename = 'postgresql-size-rotate-%Y-%m-%d-%a_%H-%M-%S.log'


After this, we can see that the Postgres log files started rotating on the basis of size

Issue/Introduction

This article summarizes on how can we rotate the cs_data_cache-.log and cs_repository_cache-.log files in TIBCO DATA VIRTUALIZATION.