Make log filename parsing more robust (Gentoo bug 503904)