Refactor log endpoints and  collection.