MDL-42892 logging: Refactor logstore_legacy to group all legacy related changes together