Documentation ¶
Overview ¶
Package log provides the log file/output poller implementation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterPoller ¶
func RegisterPoller(poller Poller)
Types ¶
type Item ¶
type Item struct { Time metav1.Time `json:"time"` Line string `json:"line"` // Matched filter that was applied to this item/line. Matched *query_log_common.Filter `json:"matched,omitempty"` Error error `json:"error,omitempty"` }
Item is the basic unit of data that poller returns. If enabled, each result is persisted in the storage. It is converted from the underlying query poller.
type Poller ¶
type Poller interface { query.Poller // Config returns the config used to start the log poller. // This is useful for debugging and logging. LogConfig() query_log_config.Config // Returns the file name that this poller watches on. File() string // Returns the commands that this poller is running. Commands() [][]string // Tails the last N lines without polling, just by reading the file // from the end of the file. // Thus, the returned items are sorted by the time from new to old. // // Useful for investing the old dmesg logs. // Use this to backfill events for the old logs. // // If select filter is none, it returns all events // that are already filtered by the default filters // in the configuration. TailScan(ctx context.Context, opts ...query_log_tail.OpOption) ([]Item, error) // Returns all the events for the given "since" time. // If none, it returns all events that are already filtered // by the default filters in the configuration. // Returns `github.com/leptonai/gpud/components/query.ErrNoData` if there is no event found. Find(since time.Time, selectFilters ...*query_log_common.Filter) ([]Item, error) // Returns the last seek info. SeekInfo() tail.SeekInfo }
Poller implements the log file poller. The underlying poller is a tail.Tail but with poll mode enabled. Poll is better when there are multiple consumers (e.g., multiple log tailers) reading from the same file.
func New ¶
func New(ctx context.Context, cfg query_log_config.Config, parseTime query_log_common.ParseTimeFunc, processMatched query_log_common.ProcessMatchedFunc) (Poller, error)
Directories ¶
Path | Synopsis |
---|---|
Package common provides the common log components.
|
Package common provides the common log components. |
Package config provides the log poller configuration.
|
Package config provides the log poller configuration. |
Package state provides the persistent storage layer for the log poller.
|
Package state provides the persistent storage layer for the log poller. |
Package tail implements the log file/output tail-ing operations.
|
Package tail implements the log file/output tail-ing operations. |
Click to show internal directories.
Click to hide internal directories.