Add suppot for migrating logs from 2.0 to 2.1

- some code cleanup and refactors
Merge pull request #2967 from davidegrohmann/2.1-migrate-logs-from-2.0

[2.1] Add support for migrating logs from 2.0 to 2.1