Fix some issues in logfile reader and rotation Upstream-commit: 26da99e326bf7cbfad820395f5379bba7a66c4a5 Component: engine