Jump to content

sort your TCA logs


Recommended Posts

Been using it for a while now, just ,never thought about sharing it before, reminded it today when checking my logs :

 

TCA logs are stored in Logs folder, each log has its own file and after weeks/months you get VERY big txt files taking ages to open and that turn out to be useless if your searching a specific info from a specific date.

 

So here is a script to run as a daily scheduled task (recommended to run at 11:59pm) so your logs are moved into a folder, this folder being named by current date thn they are deleted from their original folder.

 

This script is using robocopy (use google and download, its free) for convenience but with a slight edit you can replace robocopy by COPY.

 

Create a .bat file and copy paste the following code (put robocopy.exe next to that bat). Edit your TCA path if necessary :

 

 

set datetimetmp=%date:~6,4%-%date:~3,2%-%date:~0,2%
set datetimetmp=%datetimetmp: =%
MKDIR "C:\Program Files\TCAdmin Control Panel\ArchivedLogs\%datetimetmp%"
robocopy "C:\Program Files\TCAdmin Control Panel\Logs" "C:\Program Files\TCAdmin Control Panel\ArchivedLogs\%datetimetmp%" /R:2 /W:1 /MIR
DEL /S /Q "C:\Program Files\TCAdmin Control Panel\Logs"

Link to comment
Share on other sites

Dimitri,

 

I have a slightly modified version if you wouldn't mind i'd like to share.

 

This will work on server 2003 and server 2008. His script on server 2008 was calling the wrong time stamp variables.

 

SET DD=%DATE:~7,2%
SET MM=%DATE:~4,2%
SET YYYY=%DATE:~10,4%
SET HH=%TIME:~0,2%
SET MN=%TIME:~3,2%
SET SS=%TIME:~6,2%

MKDIR "C:\Program Files (x86)\TCAdmin Control Panel\ArchivedLogs\%YYYY%\%MM%\%DD%"
xcopy "C:\Program Files (x86)\TCAdmin Control Panel\Logs" "C:\Program Files (x86)\TCAdmin Control Panel\ArchivedLogs\%YYYY%\%MM%\%DD%" /E /C /I /F /R /Y
DEL /S /Q "C:\Program Files (x86)\TCAdmin Control Panel\Logs"

 

I also changed from robocopy to xcopy built into windows but just my preference.

 

Also i have broken this down, as i run this daily now, by year, by month, and by day so i can pull specific logs on specific days of specific months.

 

Thanks Dimitri for this.

Link to comment
Share on other sites

You made a mistake on line 9.

 

xcopy "C:\Program Files (x86)\TCAdmin Control Panel\Logs" "C:\Program Files\TCAdmin Control Panel (x86)\ArchivedLogs\%YYYY%\%MM%\%DD%" /E /C /I /F /R /Y

 

should be

 

xcopy "C:\Program Files (x86)\TCAdmin Control Panel\Logs" "C:\Program Files (x86)\TCAdmin Control Panel\ArchivedLogs\%YYYY%\%MM%\%DD%" /E /C /I /F /R /Y
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Terms of Use