BookmarkSubscribeRSS Feed
epniv
Obsidian | Level 7

Hello,

 

Running SAS v9.4 (TS1M5)

Studio is Release: 3.71 (Enterprise Edition)

 

We recently had an issue with users who could not login to SAS Studio due to insufficient space in /sasconfig. SAS support helped us correct the issue, which was excessive log build up in several subdirectories under /sasconfig. While I understand that it is important to have logs for numerous reasons, there doesn't appear to be a uniform process for cleaning out and/or archiving those logs using a management tool that could be based on date (e.g., delete if file date > 30 days from today) or other filters.

 

To this end, I'm planning to develop a Unix system script with our Sys Admin to parse through the directories that SAS Support recommended for clean-up. My current plan is to run this quarterly in crontab as sasinst and use a 30 day filter as mentioned above.

 

Has anyone else had to go through this? Any helpful hints? Are there any other methods for doing this that I haven't thought about?

 

Thanks for your time!

8 REPLIES 8
epniv
Obsidian | Level 7
Thanks for the re-direct Josvander. That is a great blog post and it really goes towards what I'm trying to accomplish. Big Ed
Kurt_Bremser
Super User

I have created a script (on AIX) to clear most of this out on a monthly basis. The script is run on every 28th of a month, so it more or less uses a similar window:

ARCFILE=/home/root/log/filelist_sasconf_`/usr/linux/bin/date +%Y%m`
echo > $ARCFILE
DATUM=`/usr/linux/bin/date --date="1 month ago" +%Y-%m`
rm -r /sasconf/Lev1/Backup/Results/${DATUM}*
rm -r /sasconf/Lev1/Backup/Logs/${DATUM}*
find /sasconf -name \*${DATUM}\* >> $ARCFILE
DATUM=`/usr/linux/bin/date --date="1 month ago" +%Y%m`
find /sasconf -name \*${DATUM}\* >> $ARCFILE

dsmc archive -filelist=$ARCFILE -deletefiles description="XXXXX" >> /home/root/log/archive_sasconf.log

It uses both date-stamp formats found in SAS log files; some of the files are simply removed (because irrelevant), and some are moved to the long-time archive. The final command starts the commandline client of IBM Tivoli Storage Manager (TSM).

epniv
Obsidian | Level 7
Thanks Kurt, We are in a Linux environment and this is the script I'm working on. It mostly has to do with Web logs and all of the output is redirected to a file which will be emailed to admins. This is designed to run quarterly. All of the directories are recommended from SAS from SAS Problem Note 52315 & 54366. This is still in testing, so I DO NOT recommend anyone using it as is... BEGIN================================== # Run SAS services status command --- Send output to script log for delivery once completed /sasconfig/Lev1/sas.servers status # Run SAS services stop command --- Send output to script log for delivery once completed /sasconfig/Lev1/sas.servers stop echo 'CleanUp_Studio_Web_Logs.scr' echo echo 'Cleaning -- /sasconfig/Lev1/Web/WebAppServer/SASServer1_1/' echo find /sasconfig/Lev1/Web/WebAppServer/SASServer1_1/logs/ -mtime +30 -print0 | xargs -0 rm -f -v find /sasconfig/Lev1/Web/WebAppServer/SASServer1_1/work/ -mtime +30 -print0 | xargs -0 rm -f -v find /sasconfig/Lev1/Web/WebAppServer/SASServer1_1/temp/* -print0 | xargs -0 rm -r -f -v find /sasconfig/Lev1/Web/WebAppServer/SASServer1_1/work/Catalina/localhost/* -print0 | xargs -0 rm -r -f -v echo echo 'Cleaning -- /sasconfig/Lev1/Web/WebAppServer/SASServer11_1/' echo find /sasconfig/Lev1/Web/WebAppServer/SASServer11_1/logs/ -mtime +30 -print0 | xargs -0 rm -f -v find /sasconfig/Lev1/Web/WebAppServer/SASServer11_1/work/ -mtime +30 -print0 | xargs -0 rm -f -v find /sasconfig/Lev1/Web/WebAppServer/SASServer11_1/temp/* -print0 | xargs -0 rm -r -f -v find /sasconfig/Lev1/Web/WebAppServer/SASServer11_1/work/Catalina/localhost/* -print0 | xargs -0 rm -r -f -v echo echo 'Cleaning -- /sasconfig/Lev1/Web/WebAppServer/SASServer2_1/' echo find /sasconfig/Lev1/Web/WebAppServer/SASServer2_1/logs/ -mtime +30 -print0 | xargs -0 rm -f -v find /sasconfig/Lev1/Web/WebAppServer/SASServer2_1/work/ -mtime +30 -print0 | xargs -0 rm -f -v find /sasconfig/Lev1/Web/WebAppServer/SASServer2_1/temp/* -print0 | xargs -0 rm -r -f -v find /sasconfig/Lev1/Web/WebAppServer/SASServer2_1/work/Catalina/localhost/* -print0 | xargs -0 rm -r -f -v echo echo 'Cleaning -- /sasconfig/Lev1/Web/WebServer/logs/' echo find /sasconfig/Lev1/Web/WebServer/logs/ -mtime +30 -print0 | xargs -0 rm -f -v echo echo 'Cleaning -- /sasconfig/Lev1/Web/gemfire/instances/ins_41415/ --> *.log & *.dat' echo find /sasconfig/Lev1/Web/gemfire/instances/ins_41415/*.log -mtime +30 -print0 | xargs -0 rm -f -v find /sasconfig/Lev1/Web/gemfire/instances/ins_41415/*.dat -mtime +30 -print0 | xargs -0 rm -f -v echo echo 'Cleaning -- /sasconfig/Lev1/Web/activemq/data/' echo find /sasconfig/Lev1/Web/activemq/data/* -print0 | xargs -0 rm -r -f -v echo echo 'Cleaning -- /sasconfig/Lev1/Web/Logs/SASServer1_1/ ../SASServer11_1/ ../SASServer2_1/' echo find /sasconfig/Lev1/Web/Logs/SASServer1_1/* -mtime +30 -print0 | xargs -0 rm -f -v find /sasconfig/Lev1/Web/Logs/SASServer11_1/* -mtime +30 -print0 | xargs -0 rm -f -v find /sasconfig/Lev1/Web/Logs/SASServer2_1/* -mtime +30 -print0 | xargs -0 rm -f -v echo echo 'I Declare These Directories Cleansed' echo # Run SAS services start command --- Send output to script log for delivery once completed /sasconfig/Lev1/sas.servers start # Run SAS services status command --- Send output to script log for delivery once completed /sasconfig/Lev1/sas.servers status ===============================================END
epniv
Obsidian | Level 7
Epic fail on posting that script - So sorry!
Kurt_Bremser
Super User

Use the {i} button for posting such scripts. This usually keeps the original format.

If it still fails to keep the linefeeds, open the script file with notepad++ or similar and do a copy/paste from there.

Kurt_Bremser
Super User
# Run SAS services status command  ---  Send output to script log for delivery once completed
/sasconfig/Lev1/sas.servers status

# Run SAS services stop command  ---  Send output to script log for delivery once completed
/sasconfig/Lev1/sas.servers stop

echo 'CleanUp_Studio_Web_Logs.scr'
echo
echo 'Cleaning -- /sasconfig/Lev1/Web/WebAppServer/SASServer1_1/'
echo
find /sasconfig/Lev1/Web/WebAppServer/SASServer1_1/logs/ -mtime +30 -print0 | xargs -0 rm -f -v
find /sasconfig/Lev1/Web/WebAppServer/SASServer1_1/work/ -mtime +30 -print0 | xargs -0 rm -f -v
find /sasconfig/Lev1/Web/WebAppServer/SASServer1_1/temp/* -print0 | xargs -0 rm -r -f -v
find /sasconfig/Lev1/Web/WebAppServer/SASServer1_1/work/Catalina/localhost/* -print0 | xargs -0 rm -r -f -v
echo
echo 'Cleaning -- /sasconfig/Lev1/Web/WebAppServer/SASServer11_1/'
echo
find /sasconfig/Lev1/Web/WebAppServer/SASServer11_1/logs/ -mtime +30 -print0 | xargs -0 rm -f -v
find /sasconfig/Lev1/Web/WebAppServer/SASServer11_1/work/ -mtime +30 -print0 | xargs -0 rm -f -v
find /sasconfig/Lev1/Web/WebAppServer/SASServer11_1/temp/* -print0 | xargs -0 rm -r -f -v
find /sasconfig/Lev1/Web/WebAppServer/SASServer11_1/work/Catalina/localhost/* -print0 | xargs -0 rm -r -f -v
echo
echo 'Cleaning -- /sasconfig/Lev1/Web/WebAppServer/SASServer2_1/'
echo
find /sasconfig/Lev1/Web/WebAppServer/SASServer2_1/logs/ -mtime +30 -print0 | xargs -0 rm -f -v
find /sasconfig/Lev1/Web/WebAppServer/SASServer2_1/work/ -mtime +30 -print0 | xargs -0 rm -f -v
find /sasconfig/Lev1/Web/WebAppServer/SASServer2_1/temp/* -print0 | xargs -0 rm -r -f -v
find /sasconfig/Lev1/Web/WebAppServer/SASServer2_1/work/Catalina/localhost/* -print0 | xargs -0 rm -r -f -v
echo
echo 'Cleaning -- /sasconfig/Lev1/Web/WebServer/logs/'
echo
find /sasconfig/Lev1/Web/WebServer/logs/ -mtime +30 -print0 | xargs -0 rm -f -v
echo
echo 'Cleaning -- /sasconfig/Lev1/Web/gemfire/instances/ins_41415/  --> *.log  &  *.dat'
echo
find /sasconfig/Lev1/Web/gemfire/instances/ins_41415/*.log -mtime +30 -print0 | xargs -0 rm -f -v
find /sasconfig/Lev1/Web/gemfire/instances/ins_41415/*.dat -mtime +30 -print0 | xargs -0 rm -f -v
echo
echo 'Cleaning -- /sasconfig/Lev1/Web/activemq/data/'
echo
find /sasconfig/Lev1/Web/activemq/data/* -print0 | xargs -0 rm -r -f -v
echo
echo 'Cleaning -- /sasconfig/Lev1/Web/Logs/SASServer1_1/  ../SASServer11_1/  ../SASServer2_1/'
echo
find /sasconfig/Lev1/Web/Logs/SASServer1_1/* -mtime +30 -print0 | xargs -0 rm -f -v
find /sasconfig/Lev1/Web/Logs/SASServer11_1/* -mtime +30 -print0 | xargs -0 rm -f -v
find /sasconfig/Lev1/Web/Logs/SASServer2_1/* -mtime +30 -print0 | xargs -0 rm -f -v
echo
echo 'I Declare These Directories Cleansed'
echo

# Run SAS services start command  ---  Send output to script log for delivery once completed
/sasconfig/Lev1/sas.servers start

# Run SAS services status command  ---  Send output to script log for delivery once completed
/sasconfig/Lev1/sas.servers status

Yep, {i} works. Opened the .txt with PSPad and did a copy/paste.

suga badge.PNGThe SAS Users Group for Administrators (SUGA) is open to all SAS administrators and architects who install, update, manage or maintain a SAS deployment. 

Join SUGA 

Get Started with SAS Information Catalog in SAS Viya

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.

Discussion stats
  • 8 replies
  • 1814 views
  • 0 likes
  • 3 in conversation