Title: The DBMS must generate audit records showing starting and ending time for user access to the database(s).
Vulnerability ID: V-58111
IA Controls: None
Description: For completeness of forensic analysis, it is necessary to know how long a user’s (or other principal’s) connection to the DBMS lasts. This can be achieved by recording disconnections, in addition to logons/connections, in the audit logs. Disconnection may be initiated by the user or forced by the system (as in a timeout) or result from a system or network failure. To the greatest extent possible, all disconnections must be logged.
Check Text: Review the DBMS audit settings. If an audit record is not generated each time a user (or other principal) logs off or disconnects from the DBMS voluntarily, or forced by the system, or because of connection or other failure, this is a finding.
Fix Text: Configure DBMS audit settings to generate an audit record each time a user (or other principal) logs off or disconnects, whether voluntarily or forced by the system, or because of connection or other failure, from the DBMS.
Ensure that the audit record contains the time of the event, the user ID, and session identifier.[divider]
SQL Server is very easy to setup to log login activity, the logout though isn’t tracked by default.
To be able to track this you can configure an Extended Event or SQL Server Audit to track both login and logout time.
The event to be tracked is the Audit Logout Event Class. The time displayed is not how long the logout process takes, but is how long the connection existed.