
- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 03-04-2022 05:04 AM
Problem Statement- We had a requirement to get all the currently logged-in users in the instance. So after doing some research we found the table Logged in Users (v_user_session) can be used for this. However, after some time, we came to know that, the table "v_user_session" stores the logged-in users for a particular node only, and because of this, our solution was not working.
Reason- The "v_user_session" table dynamically gets populated with the user's sessions. ServiceNow stores all of its configurations in the database, but logged-in sessions is actually part of the application layer and not the storage layer. As such, it's reading the logged-in sessions from the Java application. As the applications run on each individual mode, and the nodes themselves do not communicate with one another, all the logged-in user's table shows you are the logged-in users on the application node that you're on. Logging in to another node is a complete random hit-and-miss exercise of clearing your cookies and reconnecting to ServiceNow, hoping the load balancer sends you in a different direction to the node you want to be on. Not great then for finding out who's on your system.
Workaround-
1.Go to sys_user_session table-
>We can get the 'current' logged-in users from the entire instance, by filtering on "Name is not Empty" AND "Invalidated is Empty".
>The sys_user_session.invalidated column will be empty, as long as the related user session is active.
>When the session becomes inactive (either by logging out, or session being destroyed by the platform - based on the value of 'glide.ui.session_timeout' system property), sys_user_session.invalidated will be populated with the session end timestamp.
2. Normally "Logged in users" module under "User Administration" will give you the correct number of users logged in. But when Multi SSO/Single Sign-on is enabled, this module doesn't show the correct information.
You can find the users logged in by following the steps below:
- Go to xmlstats.do with include=sessions
- Example: http://appxxxxx.service-now.com:xxxxx/xmlstats.do?include=sessions
- In the <sessions> tag
- logged_in parameter shows how many users are currently logged in to this node.
Regards,
Nayan
- 10,961 Views
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
this is really helpful, Thanks Nayan
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi Nayan,
This is really helpful.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
This is really helpful. Thanks
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
This is exactly what I was looking for, thanks for posting.
Kind Regards
Ashley
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
it doesnt work in 2024. however it gave me some ideas.
You can improve sys_property glide.cluster.xmlstats by adding to the value ",sessions".
As result sys_cluster_node_stats.stats will hold sessions with user_name.
Finally you can https://***.service-now.com/sys_cluster_state_list.do?sysparm_query=node_stats.statsLIKEuser%3D%22po...
Adjust filter with your user.