BASH shell session logging on remote host
It might be worth looking at shell or system auditing programs like rootsh or sudosh.
You could start gnu screen and use the log feature. I don't know of anything that is going to give you a really good log for ncurses applications like top.
man screen
log [on|off]
Start/stop writing output of the current window to a file "screenlog.n"
in the window's default directory, where n is the number of the current
window. This filename can be changed with the `logfile' command. ...
logfile filename
logfile flush secs
Defines the name the log files will get. The default is "screenlog.%n".
The second form changes the number of seconds screen will wait before
flushing the logfile buffer to the file-system. The default value is 10
seconds.
TTYrec is probably the easiest solution. You can use the original:
http://0xcc.net/ttyrec/index.html.en
Or roll your own:
http://en.wikipedia.org/wiki/Ttyrec
Or, you could get all old school and | all your commands to tee command.timestamp.tee