Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
auditd: Retry and back-off on main log failure.
This commit revises the auditd log reading and rotation handling logic to handle the following scenarios: - Handle race between file reads and rotation by checking the current file's size against what it previously was. Set the offset to zero if it looks like a rotation happened - Retry and back-off on most errors returned by the file read. The main exception is context.Cancelled - which indicates no retry should be attempted - Use a bufio.Reader to catch io.EOF error case. Such an error indicates that we opened the file during a partial write, or that a rotation happened between the size check and the read. When an io.EOF is returned by bufio.Reader, we now return a nil error and the total number of bytes read. This allows the caller to retry a read. This code path also takes the caller through the size check, which will gracefully set the file offset back to zero if the file appears to have been rotated by auditd
- Loading branch information