logs

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MapFieldToLogLine

func MapFieldToLogLine(key string, value any, line *LogLine, config FieldMappingConfig) error

MapFieldToLogLine maps a given key-value pair to the appropriate field in the LogLine struct based on the provided FieldMappingConfig.

Types

type FieldMappingConfig

type FieldMappingConfig struct {
	ID        []string `json:"id,omitempty" yaml:"id,omitempty"`
	Message   []string `json:"message,omitempty" yaml:"message,omitempty"`
	Timestamp []string `json:"timestamp,omitempty" yaml:"timestamp,omitempty"`
	Host      []string `json:"host,omitempty" yaml:"host,omitempty"`
	Severity  []string `json:"severity,omitempty" yaml:"severity,omitempty"`
	Source    []string `json:"source,omitempty" yaml:"source,omitempty"`
	Ignore    []string `json:"ignore,omitempty" yaml:"ignore,omitempty"`
}

FieldMappingConfig defines how source log fields map to canonical LogLine fields. Each key represents a canonical field (e.g., "message", "timestamp"), and the value is a list of possible source field names.

+kubebuilder:object:generate=true

func (*FieldMappingConfig) DeepCopy

func (in *FieldMappingConfig) DeepCopy() *FieldMappingConfig

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FieldMappingConfig.

func (*FieldMappingConfig) DeepCopyInto

func (in *FieldMappingConfig) DeepCopyInto(out *FieldMappingConfig)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (FieldMappingConfig) Empty

func (c FieldMappingConfig) Empty() bool

func (FieldMappingConfig) WithDefaults

func (c FieldMappingConfig) WithDefaults(defaultMap FieldMappingConfig) FieldMappingConfig

type LogLine

type LogLine struct {
	ID            string            `json:"id,omitempty"`
	FirstObserved time.Time         `json:"firstObserved,omitempty"`
	LastObserved  *time.Time        `json:"lastObserved,omitempty"`
	Count         int               `json:"count,omitempty"`
	Message       string            `json:"message"`
	Hash          string            `json:"hash,omitempty"`
	Severity      string            `json:"severity,omitempty"`
	Source        string            `json:"source,omitempty"`
	Host          string            `json:"host,omitempty"`
	Labels        map[string]string `json:"labels,omitempty"`
}

func (LogLine) GetDedupField

func (t LogLine) GetDedupField(field string) string

func (LogLine) GetDedupKey

func (t LogLine) GetDedupKey(fields ...string) string

func (*LogLine) SetHash

func (t *LogLine) SetHash()

func (*LogLine) TemplateContext

func (t *LogLine) TemplateContext() map[string]any

type LogResult

type LogResult struct {
	Metadata map[string]any `json:"metadata,omitempty"`
	Logs     []*LogLine     `json:"logs,omitempty"`
}

type LogsRequestBase

type LogsRequestBase struct {
	// The start time for the query
	// SupportsDatemath
	Start string `json:"start,omitempty"`

	// The end time for the query
	// Supports Datemath
	End string `json:"end,omitempty"`

	// Limit is the maximum number of lines to return
	Limit string `json:"limit,omitempty" template:"true"`
}

func (*LogsRequestBase) GetEnd

func (r *LogsRequestBase) GetEnd() (time.Time, error)

func (*LogsRequestBase) GetStart

func (r *LogsRequestBase) GetStart() (time.Time, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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