Added a filter for appending the db query when fetching logs