Read $magic_number in on match instead of 1 character

Script tries again more times if log date is invalid