Hi, all
I want to record the information of EG user who logging on SAS Server, including the logging datetime, sas user name, client machine's name, client machine's IP address. So my solution is add code in the file: "C:\SAS\EMiner\Lev1\SASApp\appserver_autoexec_usermods.sas" on the server machine.
And I can get the sas user name from macro varialbe "SYSUSERID", client machine's name from macro variable "_CLIENTMACHINE", but I can't get the IP Address. Where should I can get the IP Address?
And another problem, I also want to record the log off time, so when the EG user close the EG or disconnect the SASApp server, how can I know? Where I can write the sas code to record the log off information on the server machine?
@Kurt_Bremser answered the first part of your question and provided good clues about the second part. For the second part you might be looking for the equivilent of the TERMSTMT option -- but there isn't one. However, there are cues in the ObjectSpawner log, ex:
Client connection 11 for user sassrv@l77841 closed.
You can find these informations in the ObjectSpawner log.
Logon creates messages of the type
"New client connection (number) accepted from server port serverport for user user. ..... Peer IP address and port are [::ffff:ip_address_v4]:clientport."
"Created process processnumber for user user (child id childid)."
Termination creates a message
"Process processnumber for user user (child id childid) has ended."
All messages start with a timestamp, user, processnumber and childid can be used to connect start and termination of sessions.
Thankyou very much. Sorry I can only select one solution for my post.
It seems it's the only way can get IP Address, from the ObjectSpawner log:
@Kurt_Bremser answered the first part of your question and provided good clues about the second part. For the second part you might be looking for the equivilent of the TERMSTMT option -- but there isn't one. However, there are cues in the ObjectSpawner log, ex:
Client connection 11 for user sassrv@l77841 closed.
@ChrisHemedinger wrote:
...
Client connection 11 for user sassrv@l77841 closed.
Caution, Chris: that message comes immediately after the Workspace Server session has been started, but it does not denote it's end. That comes later in the form I mentioned.
So this message is not suited to register the end of someone's workspace server activity.
Ah, you're correct @Kurt_Bremser! The ObjectSpawner's job is to authenticate and launch the sas.exe/shell script, then hand the connection over to the Workspace Server. Then get out of the way.
Thanks, Chris, you always solve my problem!
I really should invite you for dinner.
The TERMSTMT option does work. I run a little test.
Add this option in "C:\SAS\EMiner\Lev1\SASApp\sasv9.cfg" configuration file:
I trace the WorkspaceServer log, and it did executed.
And the file is created:
just for clarification.
When you say "logging on/off" - to me that's not at all equivalent when there are workspace server sessions active.
The logon/logoff events are better captured in the metadata sever log.
And before you are digging into deep with hand written parsing, take a look of what you can get from Environment Manager, and rather extend the capabilities there.
Because I'm still using 9.3 version, there is no Environemnt Manager, so I must done it by myself.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.