config

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package config provides the log poller configuration.

Index

Constants

View Source
const DefaultBufferSize = 2000

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Query query_config.Config `json:"query"`

	BufferSize int `json:"buffer_size"`

	File     string     `json:"file"`
	Commands [][]string `json:"commands"`

	// For each interval, execute the scanning operation
	// based on the following config (rather than polling).
	// This is to backtrack the old log messages.
	Scan *Scan `json:"scan,omitempty"`

	// "OR" conditions to select logs.
	// An event is generated if any of the filters match.
	// Useful for explicit blacklisting "error" logs
	// (e.g., GPU error messages in dmesg).
	SelectFilters []*query_log_common.Filter `json:"select_filters"`
	// "AND" conditions to select logs.
	// An event is generated if all of the filters do not match.
	// Useful for explicit whitelisting logs and catch all other
	// (e.g., good healthy log messages).
	RejectFilters []*query_log_common.Filter `json:"reject_filters"`

	DB       *sql.DB        `json:"-"`
	SeekInfo *tail.SeekInfo `json:"seek_info,omitempty"`

	// Used to commit the last seek info to disk.
	SeekInfoSyncer func(ctx context.Context, file string, seekInfo tail.SeekInfo) `json:"-"`
}

func ParseConfig

func ParseConfig(b any) (*Config, error)

func (*Config) SetDefaultsIfNotSet

func (cfg *Config) SetDefaultsIfNotSet()

func (*Config) Validate

func (cfg *Config) Validate() error

type Scan

type Scan struct {
	File        string     `json:"file"`
	Commands    [][]string `json:"commands"`
	LinesToTail int        `json:"lines_to_tail"`
}

For each interval, execute the scanning operation based on the following config (rather than polling). This is to backtrack the old log messages.

Jump to

Keyboard shortcuts

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