How to configure the TrapExploder LogRotate functionality
search cancel

How to configure the TrapExploder LogRotate functionality

book

Article ID: 116741

calendar_today

Updated On:

Products

CA Spectrum

Issue/Introduction

The following are the instructions for configuring the TrapExploder LogRotate functionality.

LogRotate is used to create a new log file every day, archive (compress) the previous day’s file and retain a specific number of archives (365 in this example).

This function provides an easy maintenance mechanism that also makes searching the current day or previous day’s logs easier. Without this function, a single huge file would be continuously appended to until all disk space was consumed.

Environment

TrapExploder running on Linux

Resolution

Create the Configuration file

Create a new configuration file for LogRotate in /ca/trapx/custom/conf/trapx-log-rotate.conf with the following contents:

/ca/trapx/custom/log/alltraps.txt {
copytruncate
dateext
rotate 90
daily
sharedscripts
compress
postrotate
           service trapexploder restart
endscript
}

Schedule LogRotate

To automate LogRotate to run every day at midnight edit the crontab as root by entering the following command:

crontab -e

Then add the following line below and save:

0 * * * /usr/sbin/logrotate /ca/trapx/custom/conf/trapx-log-rotate.conf