Add a script to migrate old log files.

Abstract some common log processing functionality.