Optimize log reading