refactored functions to get all logs and get logs by id in index.js