Detect User Login on the Gateway

Our machines are setup to log events that occur, we are hoping to detect the user that is logged in and log that in our event log as the operator the event occurred with.

Is there a way to detect who is logged in on the gateway PC or detect the highest level of user logged in across all the clients. Has anyone else done something like this?

You can always view who is using a client live on the gateway via the Status page -
image

I believe it just tells you the user and you can see their recent client logs.

If you want this sort of thing logged to a database with more info, I think it’s on you to to write a Startup client event script that saves a record to the database that the current user with current permissions logged in at X time, and a Shutdown script to tell the database the user logged off.

I think the second part of this might be a little more prone to being problematic - a power outage turning off a client is not going to give the time to tell the database that the user logged out.

However, if you don’t care to create an audit trail, you can prepopulate your table with all users, have a column called loggedOn or something like that with a datetime being null, and then when they log on set the loggedOn to the current time, when they log off set it to null. Save the permissions level as well.

For the second scenario where you don’t care about auditing every log on/off, you can then query to see the highest current user by SELECT * FROM logOnTable WHERE loggedOn IS NOT NULL ORDER BY permissions DESC LIMIT 1

If you do want an audit trail you can still write a query to find it but it would be slightly more complicated.

1 Like