How to configure TRAPX log rotation in NetOps 23.x and above
search cancel

How to configure TRAPX log rotation in NetOps 23.x and above

book

Article ID: 430059

calendar_today

Updated On:

Products

Network Observability Spectrum

Issue/Introduction

Our TrapX log file continuously grows in size and runs the system out of disk space.  Is there a way to configure TrapX to rotate the log?

Resolution

There is functionality built into the trapx for log rotation.  Here is the information as noted in the trapx.config file:

'file' action: 
# This action logs the trap to a file in a human-readable format.  The
# log-file option is the name of the file to log the trap to.
# max-file-size specifies the maximum size that the file can grow to, in
# kilobytes.  When the <log-file> exceeds this size, it is renamed to
# <log-file>.bak, and a new <log-file> is created.  If <log-file>.bak
# already exists when the switchover occurs, it is overwritten.  If
# max-file-size is unspecified or set to 0, then the log file will grow
# indefinitely. the file option is only for V1 trap.  
# Format:
#    file log-file [max-file-size] *
# file example:
# filter * * * * * * file /tmp/traps.log * 256 (256 represent file size which is optional)

You could use an entry such as this to limit the file to 10GB:


filter * * * * * * file /ca/trapx/custom/output/trapx_log_traps.out * 10000000

You must then cycle the SDMConnector service:

systemctl stop sdmconnector

systemctl start sdmconnector