How the CMN_SESSIONS and CMN_SESSION_AUDITS tables are updated

Document ID : KB000125539
Last Modified Date : 30/01/2019
Show Technical Document Details
Question:
How are the CMN_SESSIONS and CMN_SESSION_AUDITS updated?
Answer:
Below is the explanation of how the CMN_SESSIONS and CMN_SESSION_AUDITS are updated: 

1. CMN_SESSION_AUDITS: 

This table audits the CMN_SESSIONS table. It contains data on all activities done by users. It keeps a record of when all authenticated user sessions begin and end. 

This table is used to track user session starts and stops, i.e., login and logout. 

- The session start time = Login. 
- The session end time = Logout. 
- A null session end time occurs when a user does not click the Clarity logout button. 
- The same rules apply for Workbench and MSP and session cleanup. 
- Records are only removed from this table by the clean user session job. 

This table contains one row for each active authenticated user session. 
These sessions begin when a user logs in. 
They end either when the user logs out or when the session expires and is cleared by the session cleanup job. 


2. CMN_SESSIONS: 


All Clarity session data is stored and managed in the table called CMN_SESSIONS. The session is created as soon as the user logs in, and stays until user logs out, or refreshes the session. 
If the user refreshes the session, he is re-invited to log in, and a new session is created, while the old one is deleted. 

If the user doesn't disconnect, and just closes the window, the session will stay. If he reconnects before the timeout setting expires (configurable in Admin Tool - System Options), he will normally be able to 
reconnect without relogging to same session (if redirected to same server in cluster). 

If the user reconnects after the timeout occurs, he will get the login screen with message Session expired and the session will be deleted at this same moment. Otherwise the sessions will be kept in CMN_SESSIONS table. 


- When a user logs in, a session record is inserted into CMN_SESSIONS; the record will exist for duration of that session. 
- If the user clicks the Clarity logout button, the session record is deleted automatically. 
- If the user does not log out using the Clarity logout button, the session will be orphaned. 
- if a user did not use his/her 'x' in the upper right hand corner to close the Clarity app out, then it will not be written to that table. 
- If the user opens another browser and logs in Clarity will create a second session. 

- Using Workbench or MSP will cause a series of login and logouts due to the nature of how these tools interact with Clarity. The nature of interface is that it logs in, retrieves data and then logs out. This can happen numerous times during the time that the user is using Workbench or MSP. 
- If the Clean user sessions job is configured and running, the session information will be removed during the next job run. 

- In order for the session information to be cleaned, the (creation date and time) + (expiration time length) must add up to a time that occurred before the job run time. 


CLARITY PROCESSES: 
Clarity processes and any other external code that logs into Clarity will create a user session based on the setup of that code. Depending on the way that Clarity processes are configured, i.e., when they run based on a 
user action, it can appear that hundreds or thousands of logins have occurred especially if process processing was delayed. 
There can be multiple, identical record, if a process spawned by the user session kicks off multiple process or steps of a process simultaneously. Those sessions will be owned by the session that spawned them and have the same time stamp 


3. Clean user sessions job: 

If the timeout setting under System Options is less than x minutes, the Clean User Sessions job will delete all sessions that are closed and more than x minutes old. 

If the timeout setting under System Options is greater than x minutes, the Clean User Sessions job will delete any sessions that are closed and older than the time out setting.