Getting Rid of Unwanted Agent DevTest Log Files with Scripts Examples

book

Article ID: 10198

calendar_today

Updated On:

Products

CA Continuous Application Insight (PathFinder)

Issue/Introduction

Log files with the PID (Process ID) in the file name are not deleted by DevTest.

Most log files have a maximum size and limited number of times they will roll.

However, file names with the PID in the name will never be deleted.

Cause

N/A

Environment

All supported DevTest releases and platforms for CAI (Continuous Application Insight, formerly Pathfinder)

Resolution

A script can be automated to delete these old unwanted log files.

Note: The following scripts are provided as examples only and are not supported by Broadcom.

They are presented only as a possible solution.

***Windows***

Create a batch file with a name similar to DeleteDevTestLogs.bat, with the following three lines:

forfiles /p "pathToLogsFiles" /s /m devtest_agent_*.* /c "cmd /c Del @path" /d -40
forfiles /p "pathToLogsFiles" /s /m devtest_agent_console_*.* /c "cmd /c Del @path" /d -40
forfiles /p "pathToLogsFiles" /s /m devtest_broker_*.* /c "cmd /c Del @path" /d -40

You will need to replace pathToLogsFiles with the actual path to the log files.

Example: C:\Users\abcuser\lisatmp_10.6.0

Here are the two most common ways to automate the script (use only once method):

1. If the machine is restarted often - simply drop the script into the Windows startup folder: Usually located here but the location may change depending on your setup:
C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup

2. Use the Windows "Task Scheduler" to run the script on a regular interval like one a week/month.

***Unix***

Create a script file with a name similar to DeleteDevTestLogs.sh, with the following three lines:

find /path/to/files/devtest_agent_*.* -mtime +40 -exec rm {} \; find /path/to/files/devtest_agent_console_*.* -mtime +40 -exec rm {} \; find /path/to/files/devtest_broker_*.* -mtime +40 -exec rm {} \;

Note: Make sure the script is executable.

You will need to replace /path/to/files with the actual path to the log files.

Create a cron job to automate the script.

Additional Information

Not applicable.