Hi,
To achieve your goal, you'll need to maintain your own log file (other than the sever's own log file) to store customer login & logout time.
You may either use a flat file or a database to store the logs.
You might have noticed that many sites show the last login time, they only require to store the last login time.But as you want the login & logout time searchable you'll need to store the date & time everytime the customers logs in & logs out.