Documentation ¶
Index ¶
Constants ¶
const ( // DirReaderComponentName is the component name for the dir reader. // This is used for health checks. DirReaderComponentName = "auditlog-dirreader" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LogDirReader ¶
type LogDirReader struct {
// contains filtered or unexported fields
}
LogDirReader reads audit logs from a directory and tails the active audit log. It also gracefully handles log file rotation.
func StartLogDirReader ¶
func StartLogDirReader(ctx context.Context, dirPath string) (*LogDirReader, error)
StartLogDirReader creates and starts a LogDirReader for the specified directory path (e.g., "/var/log/audit").
The reader can be stopped by cancelling the provided context. After cancellation, users should call Wait to ensure any open files and resources are released.
func (*LogDirReader) InitFilesDone ¶
func (o *LogDirReader) InitFilesDone() <-chan struct{}
func (*LogDirReader) Lines ¶
func (o *LogDirReader) Lines() <-chan string
Lines returns a read-only channel that receives audit log lines each time a log file is written to.
func (*LogDirReader) Wait ¶
func (o *LogDirReader) Wait() error
Wait waits for the log reader to exit. Users should call this method to ensure the LogDirReader's resources have been released (e.g., that open files have been closed).
The returned error is always non-nil. When cancelled, the error must contain context.Canceled.