In general, when searching for a "howto" for something which may/should be possible on the command line, it's a good idea to first do a "man -k subject". Using grep in conjunction with this is particularly useful. For example:
man -k last |grep log
Who knows, you might even find it takes less time than posting in a forum. That's my experience anyhow.