Need to create a automated script in (Windows 2019 Servers) to clear the Log/temp files in the Midtier.
We have 1meat, 1mid and 2 compute Servers.
Right now we are doing it on manually, Need to automate to clear the files.
\Config\Lev1\Web\WebAppServer\SASServer1_1\logs
\Config\Lev1\Web\WebAppServer\SASServer1_1\temp
\Config\Lev1\Web\WebServer\logs
You need to be aware of not accidentally deleting "live logs". For this reason, I only run log "Cleanup" scripts when I take all SAS services down for monthly maintenance. I do schedule a cleanup on logs that are not live like batch logs and have some logic to delete files based on last modified date. I have attached some script snippets to hopefully give you some inspiration. I tend to wrap PowerShell scrips inside .cmd commands...but YMMV as there are so many ways to do things.
Looks like there is a logrotate like utility available on windows. The details are available at GitHub - plecos/logrotatewin: This is a Windows implementation of the logrotate utility found in Lin...
On Unix/Linux this is used routinely to archive and then remove old logs.
However, for windows recommend testing and due diligence before using it.
In case you adopt it please share your experiences for the benefit of other users.
The SAS Users Group for Administrators (SUGA) is open to all SAS administrators and architects who install, update, manage or maintain a SAS deployment.
SAS technical trainer Erin Winters shows you how to explore assets, create new data discovery agents, schedule data discovery agents, and much more.
Find more tutorials on the SAS Users YouTube channel.