log

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 25, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

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_filter.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.
	Find(since time.Time, selectFilters ...*query_log_filter.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 GetPoller

func GetPoller(fileName string) Poller

Directories

Path Synopsis
Package config provides the log poller configuration.
Package config provides the log poller configuration.
Package filter provides the log filter implementation.
Package filter provides the log filter implementation.
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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL