Improve datetime matching in log mode