02-27-2018 07:53 PM
Does anyone know how to query SAS Metadata to find list of active users accessing SAS Studio/SAS EG from certain date till now? Basically, we need to do a cleanup of users from SMC and hence we need to understand the usage statistics of all users.
Thanks in advance.
02-27-2018 10:49 PM
The usage information you require is not in SAS metadata. You can find a list of potential users in metadata, but for actual platform usage information you will need to look in log files. To save you time I would strongly suggest you start by looking at the SAS Environment Manager Service Architecture Data Marts. The Service Architecture Framework Data Mart tables contains information extracted from log files (as well as other sources). You may find the information you need in those tables (or at least a subset as a starting point).
For more information start by reading the Understanding SAS Environment Manager Service Architecture section in the SAS Environment Manager 2.5 Users Guide. In that book you will find information on how to enable the Service Architecture Framework (if not already enabled at your site), the reports available in the Report Centre, as well as information on the structure of the data mart tables.
02-28-2018 02:17 AM
I can give you example code for retrieving usage data from the spawner log, if you want to go down that path.
03-05-2018 06:28 AM
If for whatever reason the answers already provided here don't give you what you need, here is an approach that might help you gather this data moving forward. It won't give you an answer as to who has logged in in the last 3 months, but will tell you who has logged in in the next 3 . Also, as you're talking about SASStudio and EG only, this approach will cover all bases.
Assuming you're on Linux, add the following to your WorkspaceServer_usermods.sh:
echo "$(date --iso-8601),$METAUSER" >> /somepath/useraudit.txt
(note, make sure that your somepath is writable by all users)
This will over time give you a logfile that looks like this:
2018-03-03,sasdemo 2018-03-04,nik 2018-03-04,nik 2018-03-04,drjim 2018-03-04,drjim 2018-03-04,drjim 2018-03-05,allan 2018-03-05,drjim
You can see you have the date of the logon and the username. Should be relatively simple to read into SAS.
For something a bit more useful in terms of managing metadata identities, once you've read the above in you can reconcile the logins with those login's user objects using something like this.
data stuff; format userID identityID userName userDisplayName $200.; * read in your parsed log dataset ; set my_logfile_with_user_field_as_userID; * get identity of the user that logged on ; rc=metadata_getnasn(cats("omsobj:Login?@UserID contains '",userID,"'"), "AssociatedIdentity", 1, identityID); * get identity name & displayname properties; rc=metadata_getattr(identityID, "Name", userName); rc=metadata_getattr(identityID, "DisplayName", userDisplayName); run;
You'll need to run the above code with admin privileges in Metadata as it'll need to be able to read everyone's Login objects. The resulting table will tell you who logged in and when.
03-05-2018 07:22 AM
Currently we're doing this....
1.) Get a list of named users - This is really just a list of user ids extracted from /etc/passwd. User accounts follow a naming standard, so they are easy to spot.
2.) In the Workspace Server and Batch Server usermods.sh file, write a piece of code that logs $USER to a .txt file. Similar to what @boemskats is doing. Then at some point, just do a unique sort of these users ids. This will give you a unique list of users that have actually used the platform in x period. The delta between the named users and the active users is a good starting point to start some cleanups.