How to override Devise Session Features

I am a beginner at Ruby on Rails, I need to track the user activities in the application, and to keep a record of each session activities. The required fields to store in the database are: 1) all login attempts(valid/invalid) 2) sign-in time 3) sign out time 4) whether it is user signout/system time out and also any useful information to track a user activity.

The session timeout is working as below:

In devise.rb, I added : config.timeout_in = 5.minutes

and in user.rb, I added: devise :timeoutable

After session time out in the application, I need to store the user activity as 'session expired' in the database.

If it is a normal 'sign out' then also need to store that info into table.

After tons of search, i found that sign_in and sign_out features can be controlled through SessionController. But didn't get any document on how to override devise timeoutable feature.

What I need to do. Please advise.

Thanks in Advance