How to configure the TrapExploder LogRotate functionality

Document ID : KB000116741
Last Modified Date : 02/10/2018
Show Technical Document Details
Introduction:
The following are the instructions for configuring the TrapExploder LogRotate functionality.
Background:
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
Instructions:
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