Architecting, installing and maintaining your SAS environment

Find work of a specific Metadatauser

Accepted Solution Solved
Reply
Contributor
Posts: 53
Accepted Solution

Find work of a specific Metadatauser

[ Edited ]

Hey,

 

I want to find the work directory of a specific user. I'm on SAS 9.4M2 and AIX 7.1. I have access to the directory on AIX where all the work directories are stored and I can see names like this one:

/work/SAS_work591503DB00F0_cdb2/SAS_workC10603DB00F0_cdb2 - This is my current work for example.

 

Is there a way to match this folder to my metauser?

 

Kind regards

David

 

P.S. I know about %sysfunc(getoption(work)) but I'm looking for something where I can add the parameter of a userId or proc options option=work;


Accepted Solutions
Solution
‎09-20-2017 07:14 AM
SAS Employee
Posts: 318

Re: Find work of a specific Metadatauser

[ Edited ]

@Criptic,

 

When you invoke SAS, it assigns the Work libref to a subdirectory of the directory specified in the WORK system option described in WORK System Option: UNIX. This subdirectory is usually named SAS_workcode_nodename, and has the following characteristics:

 

workcode
is a 12-character code. The first four characters are randomly generated numbers. The next eight characters are based on the hexadecimal process identification number of the SAS session.

 

nodename
is the name of the UNIX computer where the SAS process is running.

View solution in original post


All Replies
Regular Contributor
Posts: 211

Re: Find work of a specific Metadatauser

Depending on how your security is set up, the AIX user that owns that folder will be the user that's running the SAS jobs.

Contributor
Posts: 53

Re: Find work of a specific Metadatauser

Thank you for your response.

 

Sadly the owner of the workfolder is a technical users, as the SAS-Users don't have profiles on the AIX

Regular Contributor
Posts: 211

Re: Find work of a specific Metadatauser

Ok, try this....Its a bit manual, but it should do the trick...

 

Look at the name of the workspace directory and get the PID of the SAS process. In this case you will convert 00F0 from hex to decimal and get a process ID of 240. Look up this PID in the Object Spawer log to see if you can figure out for which client it was created. You might see the requesting client is the Technical User, but should also be able to get the SAS application and IP address that made the request.

Regular Contributor
Posts: 211

Re: Find work of a specific Metadatauser

If you have Workspace Server logging enabled (that includes the PID in the log file name) you could also look at the %LET _CLIENTUSERID = 'xxx' value that SAS Enterprise Guide writes to the log. That could also help...

Contributor
Posts: 53

Re: Find work of a specific Metadatauser

Thank you again for your time. I'm accepted a different answer as my solution as it was way easier to automate but thank you again for the effort and response!

Frequent Contributor
Posts: 106

Re: Find work of a specific Metadatauser

Hi @Criptic

Sadly the owner of the workfolder is a technical users, as the SAS-Users don't have profiles on the AIX

Contributor
Posts: 53

Re: Find work of a specific Metadatauser

[ Edited ]
Posted in reply to boemskats

Thank you for your reply.
I ran across your tool in another post on the forum. Your tool looks great but it is complete overkill for what I'm trying to achieve here.

Frequent Contributor
Posts: 106

Re: Find work of a specific Metadatauser

Fair - I had to mention it Smiley Happy

 

If you're scripting have a look at this bit of worktop specifically as it's one mechanism for metadata user identification at filesystem level:

 

https://github.com/Boemska/worktop#3-update-your-workspace-server-config

 

Nik

Solution
‎09-20-2017 07:14 AM
SAS Employee
Posts: 318

Re: Find work of a specific Metadatauser

[ Edited ]

@Criptic,

 

When you invoke SAS, it assigns the Work libref to a subdirectory of the directory specified in the WORK system option described in WORK System Option: UNIX. This subdirectory is usually named SAS_workcode_nodename, and has the following characteristics:

 

workcode
is a 12-character code. The first four characters are randomly generated numbers. The next eight characters are based on the hexadecimal process identification number of the SAS session.

 

nodename
is the name of the UNIX computer where the SAS process is running.

Contributor
Posts: 53

Re: Find work of a specific Metadatauser

Thank you. This is perfect for what I'm trying to do.

SAS Employee
Posts: 318

Re: Find work of a specific Metadatauser

@Criptic,

 

You are welcome!

Frequent Contributor
Posts: 134

Re: Find work of a specific Metadatauser

Using the information provided above by @alexal and the SMC, Server plug-in monitoring feature, you can retrieve the information and join manually SAS Session PID and Work path :

 

https://support.sas.com/documentation/cdl/en/bisag/68240/HTML/default/viewer.htm#p0o497lmygjfrfn0z7t...

 

Automating this join shouldn't be unfeasible either :

 

https://blogs.sas.com/content/sasdummy/2016/02/15/using-proc-iomoperate/

 

 

 

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 12 replies
  • 539 views
  • 3 likes
  • 5 in conversation