Implement incremental log read and counting

The counters are now out of the main loop and we incrementally read the
target file as contents is added to it.