Logs. They can be an administrator’s best friend or a thorn in their side. Who among us hasn’t seen a system choked to death by logs overtaking a filesystem? Thankfully, the chances of that happening with your SAS Viya 3.3 deployment is greatly reduced due to the automatic management of log files by the SAS Operations Infrastructure, which archives log files every day.
With a default installation of SAS Viya 3.3, log files older than three days will be automatically zipped up, deleted, and stored in /opt/sas/viya/config/var/log. This process is managed by the sas-ops-agent process on each machine in your deployment. According to SAS R&D, this results in up to a 95% compression rate on the overall log file requirements.
The task that archives log files is managed by the sas-ops-agent on each machine. Running ./sas-ops tasks shows that the LogFileArchive process runs daily at 0400:
{ "version": 1, "taskName": "LogfileArchive", "description": "Archive daily", "hostType": "linux", "runType": "time", "frequency": "0000-01-01T04:00:00-05:00", "maxRunTime": "2h0m0s", "timeOutAction": "restart", "errorAction": "cancel", "command": "sas-archive", "commandType": "sas", "publisherType": "none" }, |
While the logs are zipped to reduce size, the zip files are stored locally so additional maintenance may be required to move the zipped files to another location. For example, my test system illustrates that the zip files are retained once created.
[sas@intviya01 log]$ ll total 928 drwxr-xr-x. 3 sas sas 20 Jan 24 14:19 alert-track drwxrwxr-x. 3 sas sas 20 Jan 24 16:13 all-services drwxr-xr-x. 3 sas sas 20 Jan 24 14:23 appregistry ... drwxr-xr-x. 4 sas sas 31 Jan 24 14:20 evmsvrops drwxr-xr-x. 3 sas sas 20 Jan 24 14:27 home drwxr-xr-x. 3 root sas 20 Jan 24 14:18 httpproxy drwxr-xr-x. 3 sas sas 20 Jan 24 14:35 importvaspk -rw-r--r--. 1 sas sas 22 Jan 26 04:00 log-20180123090001Z.zip -rw-r--r--. 1 sas sas 22 Jan 27 04:00 log-20180124090000Z.zip -rw-r--r--. 1 sas sas 22 Jan 28 04:00 log-20180125090000Z.zip -rw-r--r--. 1 sas sas 10036 Jan 29 04:00 log-20180126090000Z.zip -rw-r--r--. 1 sas sas 366303 Mar 6 04:00 log-20180303090000Z.zip -rw-r--r--. 1 sas sas 432464 Apr 3 04:00 log-20180331080000Z.zip -rw-r--r--. 1 sas sas 22 Apr 4 04:00 log-20180401080000Z.zip -rw-r--r--. 1 sas sas 22 Apr 5 04:00 log-20180402080000Z.zip -rw-r--r--. 1 sas sas 15333 Apr 6 04:00 log-20180403080000Z.zip -rw-r--r--. 1 sas sas 21173 Apr 7 04:00 log-20180404080000Z.zip -rw-r--r--. 1 sas sas 22191 Apr 8 04:00 log-20180405080000Z.zip -rw-r--r--. 1 sas sas 21185 Apr 9 04:00 log-20180406080000Z.zip -rw-r--r--. 1 sas sas 21405 Apr 10 04:00 log-20180407080000Z.zip drwxr-xr-x. 3 sas sas 20 Jan 24 14:33 monitoring |
If three days is too short of a time to retain logs, you can adjust the default timeframe for archiving logs by modifying the default task list for the sas-ops-agent on each machine.
Edit the tasks.json file to suit your needs and then issue a command to modify the task template for sas-ops-agent processes. For example, this will modify the log archive process to retain seven days of information:
... { "version": 1, "taskName": "LogfileArchive", "description": "Archive daily", "hostType": "linux", "runType": "time", "frequency": "0000-01-01T04:00:00-05:00", "maxRunTime": "2h0m0s", "timeOutAction": "restart", "errorAction": "cancel", "command": "sas-archive -age 7", "commandType": "sas", "publisherType": "none" }, ... $ ./sas-ops-agent import -tasks tasks.jason |
Restart the sas-ops-agent processes on each of your machines and you will be good to go.
I hope you found this post helpful.
Additional Resources for Administrators
SAS Administrators Home Page
How-to Videos for Administrators
SAS Administration Community
SAS Administrators Blogs
SAS Administrator Training
SAS Administrator Certification
8 Comments
Wow! I knew it was easy ... I didn't know it was THAT easy!
Thanks Scott.
Thanks for reading, Tricia.
Hi Scott,
There are great information in here, I do have a question am running code in SASStuidoV in Viya 3.4 and have scheduled my job in the SASJobExecution window and scheduled it to run, after scheduling my job but i am not able to see logs my job/code that am running in SASEvnivronmentManager (option to download ) logs ?
Do you how to get the logging done here ?
-Rahul
Hi Rahul. There are some situations that result in no logs being generated for a scheduled job. Some that I know about are timeouts and data source not found. I'm not sure if either of these might be happening for you but I encourage you to contact Technical Support so they can help diagnose your particular issue. Thanks for reading...
Hi Scott,
thank you for your great stuff. I do have a question running Viya 3.4 and the sas-archive command will create zip-files which will only be 22Bytes.
-rw-r--r-- 1 sas sas 22 10. Dez 13:07 log-20181110120702Z.zip
-rw-r--r-- 1 sas sas 22 11. Dez 04:00 log-20181111030000Z.zip
-rw-r--r-- 1 sas sas 22 12. Dez 04:00 log-20181112030000Z.zip
-rw-r--r-- 1 sas sas 22 13. Dez 04:00 log-20181113030000Z.zip
-rw-r--r-- 1 sas sas 22 14. Dez 04:00 log-20181114030000Z.zip
-rw-r--r-- 1 sas sas 22 14. Dez 13:38 log-20181114123815Z.zip
-rw-r--r-- 1 sas sas 22 14. Dez 15:06 log-20181114140611Z.zip
Comparing your listing above, there will also be some 22 Bytes zip-files.
How can I adjust sas-archive to collect all needed log-files? Or did i miss anything.
I already tried to run sas-archive manually see above, but zip still not containing any log-files.
Thank you
Best Regards
Martin Kolberg
Hi Martin,
Those 22 byte ZIP files are created when no logs below /opt/sas/viya/config are eligible for archiving. That could mean that they haven't aged sufficiently or they are currently being used. I expect that in time you will begin to see those ZIP files grow in size once the aging threshhold has been met.
You can adjust the log archive threshhold by modifying the LogArchive task of the sas-ops-agent. You can add a -days nn parameter to the command to set the threshhold to the length you prefer.
Thanks for reading,
-Scott
Hi Scott,
Great information. I've been looking for this information, although not very thoroughly, then I stumbled across this blog entry. I've seen the many log-0000Z.log files and wondered what process was creating them and how would I change it's settings. Now I know. You saved me time searching the admin guide. Thank you!
Scott V.
Hey, glad it was of help. Thanks for reading!