logconfig

package
v0.25.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// OutputType
	NoOutput outputType = ""
	Stdout   outputType = "stdout"
	Stderr   outputType = "stderr"
	File     outputType = "file"

	// TransformType
	NoTransform transformType = ""
	// Filter log lines
	Filter transformType = "filter"
	// Remove key-val pairs from each log line
	Prune transformType = "prune"
	// Add key value pairs to each log line
	Label     transformType = "label"
	Capture   transformType = "capture"
	Sort      transformType = "sort"
	Vectorise transformType = "vectorise"

	NoFilterMode          filterMode = ""
	IncludeWhenAllMatch   filterMode = "include_when_all_match"
	IncludeWhenAnyMatches filterMode = "include_when_any_match"
	ExcludeWhenAllMatch   filterMode = "exclude_when_all_match"
	ExcludeWhenAnyMatches filterMode = "exclude_when_any_match"
)

Variables

This section is empty.

Functions

func BuildFilterPredicate

func BuildFilterPredicate(filterConfig *FilterConfig) (func([]interface{}) bool, error)

func BuildKeyValuesPredicate

func BuildKeyValuesPredicate(kvpConfigs []*KeyValuePredicateConfig, matchAll bool) (func([]interface{}) bool, error)

func BuildLoggerFromSinkConfig

func BuildLoggerFromSinkConfig(sinkConfig *SinkConfig, captures map[string]*loggers.CaptureLogger) (log.Logger,
	map[string]*loggers.CaptureLogger, error)

func BuildOutputLogger

func BuildOutputLogger(outputConfig *OutputConfig) (log.Logger, error)

func BuildTransformLogger

func BuildTransformLogger(transformConfig *TransformConfig, captures map[string]*loggers.CaptureLogger,
	outputLogger log.Logger) (log.Logger, map[string]*loggers.CaptureLogger, error)

func BuildTransformLoggerPassthrough

func BuildTransformLoggerPassthrough(transformConfig *TransformConfig, captures map[string]*loggers.CaptureLogger,
	outputLogger log.Logger) (log.Logger, map[string]*loggers.CaptureLogger, error)

func JSONString

func JSONString(v interface{}) string

func TOMLString

func TOMLString(v interface{}) string

Types

type CaptureConfig

type CaptureConfig struct {
	Name        string
	BufferCap   int
	Passthrough bool
}

Sink configuration types

type FileConfig

type FileConfig struct {
	Path string
}

Sink configuration types

type FilterConfig

type FilterConfig struct {
	FilterMode filterMode
	// Predicates to match a log line against using FilterMode
	Predicates []*KeyValuePredicateConfig
}

Filter types

func (*FilterConfig) AddPredicate

func (filterConfig *FilterConfig) AddPredicate(keyRegex, valueRegex string) *FilterConfig

func (*FilterConfig) SetFilterMode

func (filterConfig *FilterConfig) SetFilterMode(filterMode filterMode) *FilterConfig

type KeyValuePredicateConfig

type KeyValuePredicateConfig struct {
	KeyRegex   string
	ValueRegex string
}

Generates true if KeyRegex matches a log line key and ValueRegex matches that key's value. If ValueRegex is empty then returns true if any key matches If KeyRegex is empty then returns true if any value matches

type LabelConfig

type LabelConfig struct {
	Labels map[string]string
	Prefix bool
}

Transforms

type LoggingConfig

type LoggingConfig struct {
	RootSink *SinkConfig `toml:",omitempty"`
	// Trace debug is very noisy - mostly from Tendermint
	Trace bool
	// Send to a channel - will not affect progress if logging graph is intensive but output will lag and some logs
	// may be missed in shutdown
	NonBlocking bool
}

func DefaultNodeLoggingConfig

func DefaultNodeLoggingConfig() *LoggingConfig

func New

func New() *LoggingConfig

func (*LoggingConfig) JSONString

func (lc *LoggingConfig) JSONString() string

func (*LoggingConfig) Root

func (lc *LoggingConfig) Root(configure func(sink *SinkConfig) *SinkConfig) *LoggingConfig

func (*LoggingConfig) RootJSONString

func (lc *LoggingConfig) RootJSONString() string

func (*LoggingConfig) RootTOMLString

func (lc *LoggingConfig) RootTOMLString() string

Returns the TOML for a top-level logging config wrapped with [logging]

func (*LoggingConfig) TOMLString

func (lc *LoggingConfig) TOMLString() string

type LoggingConfigWrapper

type LoggingConfigWrapper struct {
	Logging *LoggingConfig `toml:",omitempty"`
}

For encoding a top-level '[logging]' TOML table

type OutputConfig

type OutputConfig struct {
	OutputType    outputType
	Format        string
	*FileConfig   `json:",omitempty" toml:",omitempty"`
	*SyslogConfig `json:",omitempty" toml:",omitempty"`
}

Sink configuration types

func FileOutput

func FileOutput(path string) *OutputConfig

func StderrOutput

func StderrOutput() *OutputConfig

func StdoutOutput

func StdoutOutput() *OutputConfig

func (*OutputConfig) SetFormat

func (outputConfig *OutputConfig) SetFormat(format string) *OutputConfig

type PruneConfig

type PruneConfig struct {
	Keys        []string
	IncludeKeys bool
}

Sink configuration types

type SinkConfig

type SinkConfig struct {
	Transform *TransformConfig `json:",omitempty" toml:",omitempty"`
	Sinks     []*SinkConfig    `json:",omitempty" toml:",omitempty"`
	Output    *OutputConfig    `json:",omitempty" toml:",omitempty"`
}

Sink A Sink describes a logger that logs to zero or one output and logs to zero or more child sinks. before transmitting its log it applies zero or one transforms to the stream of log lines. by chaining together many Sinks arbitrary transforms to and multi

func Sink

func Sink() *SinkConfig

Builders

func (*SinkConfig) AddSinks

func (sinkConfig *SinkConfig) AddSinks(sinks ...*SinkConfig) *SinkConfig

func (*SinkConfig) BuildLogger

func (sinkConfig *SinkConfig) BuildLogger() (log.Logger, map[string]*loggers.CaptureLogger, error)

Logger formation

func (*SinkConfig) SetOutput

func (sinkConfig *SinkConfig) SetOutput(output *OutputConfig) *SinkConfig

func (*SinkConfig) SetTransform

func (sinkConfig *SinkConfig) SetTransform(transform *TransformConfig) *SinkConfig

type SortConfig

type SortConfig struct {
	// Sort keys-values with keys in this list first
	Keys []string
}

Sink configuration types

type SyslogConfig

type SyslogConfig struct {
	Url string
	Tag string
}

Outputs TODO: reintroduce syslog removed when we dropped log15 dependency

type TransformConfig

type TransformConfig struct {
	TransformType transformType
	LabelConfig   *LabelConfig   `json:",omitempty" toml:",omitempty"`
	PruneConfig   *PruneConfig   `json:",omitempty" toml:",omitempty"`
	CaptureConfig *CaptureConfig `json:",omitempty" toml:",omitempty"`
	FilterConfig  *FilterConfig  `json:",omitempty" toml:",omitempty"`
	SortConfig    *SortConfig    `json:",omitempty" toml:",omitempty"`
}

Sink configuration types

func CaptureTransform

func CaptureTransform(name string, bufferCap int, passthrough bool) *TransformConfig

func FilterTransform

func FilterTransform(fmode filterMode, keyValueRegexes ...string) *TransformConfig

func LabelTransform

func LabelTransform(prefix bool, labelKeyvals ...string) *TransformConfig

func OnlyTransform added in v0.20.1

func OnlyTransform(keys ...string) *TransformConfig

func PruneTransform

func PruneTransform(keys ...string) *TransformConfig

func SortTransform

func SortTransform(keys ...string) *TransformConfig

func VectoriseTransform

func VectoriseTransform() *TransformConfig

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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