BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Slash
Quartz | Level 8

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?

1 ACCEPTED SOLUTION

Accepted Solutions
ChrisHemedinger
Community Manager

@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.

 

SAS For Dummies 3rd Edition! Check out the new edition, covering SAS 9.4, SAS Viya, and all of the modern ways to use SAS!

View solution in original post

8 REPLIES 8
Kurt_Bremser
Super User

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.

Slash
Quartz | Level 8

Thankyou very much. Sorry I can only select one solution for my post.Smiley Sad

It seems it's the only way can get IP Address, from the ObjectSpawner log:

 

QQ图片20160530213230.png

ChrisHemedinger
Community Manager

@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.

 

SAS For Dummies 3rd Edition! Check out the new edition, covering SAS 9.4, SAS Viya, and all of the modern ways to use SAS!
Kurt_Bremser
Super User

@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.

ChrisHemedinger
Community Manager

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.

SAS For Dummies 3rd Edition! Check out the new edition, covering SAS 9.4, SAS Viya, and all of the modern ways to use SAS!
Slash
Quartz | Level 8

Thanks, Chris, you always solve my problem! Smiley Very Happy

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:

 

Catch.jpg

 

I trace the WorkspaceServer log, and it did executed.

 

Catch4734.jpg

 

And the file is created:

Catch4AF0.jpg

LinusH
Tourmaline | Level 20

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.

Data never sleeps
Slash
Quartz | Level 8

Because I'm still using 9.3 version, there is no Environemnt Manager, so I must done it by myself.Smiley Wink

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 8 replies
  • 7596 views
  • 5 likes
  • 4 in conversation