Nothing is monitoring session expiry, so you cannot log it.
There is a cleanup job that randomly deletes expired sessions but I doubt you could hook into that.
Consider the case where you have just one user on your site. They connect and a session is created, they continue to use the site and the session is refreshed. At some point they just go away (close their browser, shut down the device etc)
That session is just sat there. It is not being looked at and no scripts are running on your server. The session data has an expiry time on it.
Some time later, the user returns and a new session is started. Now there are two session files, one is expired and one is new. The expired one sits there until selected randomly for deletion.
Snapey thanks for the reply. Currently I register login and logout (if it is done), but if the user expires the session I can not understand the time of activity. I would need to understand how long a user has been active for that activity.
Can not do anything?