Unwanted DevTest Log Files

Document ID : KB000010198
Last Modified Date : 14/02/2018
Show Technical Document Details
Introduction:

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

Background:

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.

Environment:
All supported DevTest CAI platforms.
Instructions:

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 CA.
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\MartinZaelgel\lisatmp_9.5.1

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.