Move 'unpack_log' to util, use common read code.