How can I automatically limit my NTSLOG to contain only a certain number of days worth of session data?
search cancel

How can I automatically limit my NTSLOG to contain only a certain number of days worth of session data?

book

Article ID: 22600

calendar_today

Updated On:

Products

NetMaster Network Automation SOLVE NetMaster Network Management for SNA NetMaster Network Management for TCP/IP NetMaster File Transfer Management

Issue/Introduction

The Network Tracking System Log (NTSLOG) is designed to be self adjusting and maintenance free. However, for some customers who have a very large number of SNA sessions, the required size of the NTSLOG might become quite large as well. This document describes how you can set up a process utilizing the NTSDBMOD command to automatically clean up NTSLOG and only keep x number of days worth of session data for review.

 

Resolution

The NTSDBMOD command can be used to delete old data from NTSLOG. The format of the NTSDBMOD command to purge NTSLOG records older than date yy/mm/dd is as follows:

NTSDBMOD KEEPDATE=yy/mm/dd where any records older than yy/mm/dd will be purged from the database.

How can we automate this process when a hard coded date is required for the KEEPDATE parameter?

The following NCL code is an example of how to address that:

-*****************************
-********** NTSMAINT *********
-*****************************
&control noendmsg
-***************************************************************
-* Get the date for xx days ago and plug into NTSDBMOD command *
-***************************************************************
&keepdate = &dateconv date6 &date6 date6 -xx
&write data=&0 is issuing command: NTSDBMOD KEEPDATE=&keepdate
NTSDBMOD KEEPDATE=&keepdate
&end

Copy this NCL to your TESTEXEC library and replace xx with the number of days for which you wish to keep session data. You can name the member whatever you wish, however, for the purpose of illustration, I'll call this version NTSMAINT. So, if you want to keep 14 days of data, the NTSMAINT proc would look like this:

-*****************************
-********** NTSMAINT *********
-*****************************
&control noendmsg
-***************************************************************
-* Get the date for xx days ago and plug into NTSDBMOD command *
-***************************************************************
&keepdate = &dateconv date6 &date6 date6 -14
&write data=&0 is issuing command: NTSDBMOD KEEPDATE=&keepdate
NTSDBMOD KEEPDATE=&keepdate
&end

Here is an example of the output produced in the region activity log when the NTSMAINT run completes:

NTSMAINT is issuing command: NTSDBMOD KEEPDATE=10/09/27
N74306 NTSDBMOD REQUEST ACCEPTED.
N73E03 NTSDBMOD PROCESSING COMPLETED SUCCESSFULLY.
N73E05 989 MASTER RECORDS UPDATED.
N73E05 9588 MASTER RECORDS DELETED.
N73E05 44041 SESSION RECORDS DELETED.
N73E05 53629 TOTAL RECORDS DELETED.

In the previous example, the &dateconv verb takes the current date in yy/mm/dd format stored in system variable &date6, converts it to the date from 14 days ago and stores it in &keepdate. Now, anytime this proc is run, the KEEPDATE parm used by NTSDBMOD is automatically set to 14 days prior to the current date, and any records in NTSLOG older than that date will be purged.

The last step required to fully automate the execution of NTSMAINT (or whatever your chosen name for the NCL proc is) is defining a timer to initiate the process each day. An example follows:

AT HH.MM.SS KEEP=SYS CMD=NTSMAINT

where you would replace HH.MM.SS with the time you would like to execute the NCL each day. So, if you wanted your NCL to execute at 2 am each day, the timer command would look like this:

AT 02.00.00 KEEP=SYS CMD=NTSMAINT

Place this timer command in your NMREADY procedure to ensure it gets run at system initialization time, or you can initiate it at any time from CMD entry as well. Just keep in mind that the timer command will not be in effect over a restart of the region if it is not hardened for restart in NMREADY as previously discussed. Once the timer rule has been activated, at 2:00 am each morning, NTSMAINT will be executed and will delete any records from NTSLOG older than 14 days, automatically.

 

Additional Information

For more information on the AT timer command, NTSDBMOD and how to display and purge timers, please see the online help for each by entering the following from the Command Entry panel:

HELP AT
HELP NTSDBMOD
HELP PURGE  
HELP SH TIMER

For more information on usage of the &DATECONV NCL verb can be found here.