logs

package
v1.0.1223 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2026 License: Apache-2.0 Imports: 9 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultMessageFields = []string{"msg", "message"}

Functions

func DetectFormat added in v1.0.1223

func DetectFormat(msg string) string

func GroupLogs added in v1.0.1223

func GroupLogs(result *LogResult, config FieldMappingConfig)

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.

func ParseAutodetect added in v1.0.1223

func ParseAutodetect(line *LogLine)

func ParseJSON added in v1.0.1223

func ParseJSON(line *LogLine)

func ParseKlogfmt added in v1.0.1223

func ParseKlogfmt(line *LogLine)

func ParseLogfmt added in v1.0.1223

func ParseLogfmt(line *LogLine)

func ParseMessage added in v1.0.1223

func ParseMessage(line *LogLine, format string)

func ParseSyslog added in v1.0.1223

func ParseSyslog(line *LogLine)

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"`
	GroupBy   []string `json:"groupBy,omitempty" yaml:"groupBy,omitempty"`
	DedupBy   []string `json:"dedupBy,omitempty" yaml:"dedupBy,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 LogGroup added in v1.0.1223

type LogGroup struct {
	Name   string            `json:"name,omitempty"`
	ID     string            `json:"id,omitempty"`
	Labels map[string]string `json:"labels,omitempty"`
	Logs   []*LogLine        `json:"logs,omitempty"`
}

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) EffectiveMessage added in v1.0.1223

func (t LogLine) EffectiveMessage(messageFields ...string) string

func (LogLine) GetFieldKey added in v1.0.1223

func (t LogLine) GetFieldKey(fields []string, messageFields ...string) string

func (LogLine) GetFieldValue added in v1.0.1223

func (t LogLine) GetFieldValue(field string, messageFields ...string) string

func (*LogLine) SetHash

func (t *LogLine) SetHash()

func (*LogLine) TemplateContext

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

type LogResult

type LogResult struct {
	Metadata map[string]any `json:"metadata,omitempty"`
	Logs     []*LogLine     `json:"logs,omitempty"`
	Groups   []*LogGroup    `json:"groups,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
ABOUTME: Implements log searching against Azure Monitor Log Analytics workspaces.
ABOUTME: Implements log searching against Azure Monitor Log Analytics workspaces.

Jump to

Keyboard shortcuts

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