Documentation ¶
Overview ¶
Package tail implements the log file/output tail-ing operations.
Index ¶
- func Scan(ctx context.Context, opts ...OpOption) (int, error)
- type Line
- type Op
- type OpOption
- func WithCommands(commands [][]string) OpOption
- func WithFile(file string) OpOption
- func WithLinesToTail(n int) OpOption
- func WithParseTime(f ParseTimeFunc) OpOption
- func WithPerLineFunc(f func([]byte)) OpOption
- func WithProcessMatched(f ProcessMatchedFunc) OpOption
- func WithRejectFilter(filters ...*query_log_filter.Filter) OpOption
- func WithSelectFilter(filters ...*query_log_filter.Filter) OpOption
- type ParseTimeFunc
- type ProcessMatchedFunc
- type Streamer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type OpOption ¶
type OpOption func(*Op)
func WithCommands ¶
func WithLinesToTail ¶
Sets the number of lines to tail. If not set, defaults to 100.
func WithParseTime ¶
func WithParseTime(f ParseTimeFunc) OpOption
func WithProcessMatched ¶
func WithProcessMatched(f ProcessMatchedFunc) OpOption
Called if the line is matched. If not set, the matched line is no-op. Useful to append to a slice or not to return a string slice to avoid extra heap allocation.
func WithRejectFilter ¶
func WithRejectFilter(filters ...*query_log_filter.Filter) OpOption
"AND" conditions to exclude logs.
The line is sent if and only if all of the filters do not match. Useful for explicit whitelisting logs and catch all other (e.g., good healthy log messages).
func WithSelectFilter ¶
func WithSelectFilter(filters ...*query_log_filter.Filter) OpOption
"OR" conditions to select logs.
The line is sent when any of the filters match. Useful for explicit blacklisting "error" logs (e.g., GPU error messages in dmesg).
type ProcessMatchedFunc ¶
type ProcessMatchedFunc func([]byte, time.Time, *query_log_filter.Filter)
type Streamer ¶
type Streamer interface { // Returns the file that the streamer watches on. File() string // Returns the command arguments that the streamer watches on. Commands() [][]string // Returns the line channel that the streaming lines are sent to. Line() <-chan Line }
Streamer defines the log tailer.