.logout

I want to execute script while exiting a session, to gather session details. How to implement this in Solaris 10

This is not that much related to the O/S but really to the shell you use.

Like jlliagre said, it depends on the shell. As far as I know, csh provides you with .logout that runs commands while logging out of a session, while bash provides you with .bash_logout. Ksh and sh do not provide this functionality.

Actually, with sh and ksh,

trap "$HOME/.logout EXIT"

can be use for the very same purpose.