The log file is ~/.bitmonero/bitmonero.log. On Windows, it is somewhere else which someone who knows will edit here soon.
The status command reports your hash rate. If you're running a detached monerod:
./monerod status
You could use watch to run this at whatever interval you want, eg:
watch -n 60 monerod status >> /tmp/monerod.log
Or you could grep the log, where the hash rate goes once requested by the show_hr command you included:
tail -f ~/.bitmonero/bitmonero.log | grep --line-buffered hashrate:
Edit: The hashrate isn't logged, as mentioned below. Another way, then:
(watch -t -n 60 './monerod status >> /tmp/monerod.log'&) 2>&1 2> /dev/null; tail -f /tmp/monerod.log