Archive and cleanup the time based ssg logs

book

Article ID: 130825

calendar_today

Updated On:

Products

STARTER PACK-7 CA Rapid App Security CA API Gateway

Issue/Introduction

When "Roll logs based on time period" is selected for a log sink, the log will be generated based on time period.
There is no size limit of time based logs, there is no limit on the number of the log files.
Therefore it may consume all disk space if old log files are not remove manually.

Environment

Release:
Component: APIGTW

Resolution

The sample command below move to logs older than 2 days to an archive folder (/tmp)

find /opt/SecureSpan/Gateway/node/default/var/logs/ -type f -name 'ssg*.log' -mtime +2 -exec mv {} /tmp \;

* "-mtime +2" is to list the files 2 days ago 
* "-exec mv {} /tmp \;" is to run the mv command to each listed file 

Put the command in cron job to run it every day (or any interval)