input

package
v0.1.2-rc8 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KlogRegex     = `\d{4} \d{2}:\d{2}:\d{2}.\d{6}`
	EtcdRegex     = `^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}.\d{6}`
	RancherRegex  = `^\d{4}/\d{2}/\d{2} \d{2}:\d{2}:\d{2}`
	JournaldRegex = `^[A-Z][a-z]{2} \d{1,2} \d{2}:\d{2}:\d{2}`

	RancherLayout  = "2006/01/02 15:05:05"
	KlogLayout     = "0102 15:04:05.999999 MST 2006"
	JournaldLayout = "Jan 02 15:04:05 MST 2006"
)
View Source
const (
	EtcdTimestampRegex  = `^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}.\d{6}`
	EtcdTimestampLayout = "2006-01-02 15:04:05.999999Z07:00"
	RFC3339Milli        = "2006-01-02T15:04:05.999Z07:00"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ComponentInput

type ComponentInput interface {
	Publish(parser DateParser, logType string) (time.Time, time.Time, error) // Publish should read the contents of component logs and publish them to the payload endpoint.
	ComponentName() string
}

type DateParser

type DateParser interface {
	ParseTimestamp(log string) (time.Time, string, bool) // Parse timestamp should have the implementation for parsing the timestamp from a log line
}

type DateZoneParser

type DateZoneParser struct {
	// contains filtered or unexported fields
}

func NewDateZoneParser

func NewDateZoneParser(timezone string, year string, datetimeRegex string, layout string) *DateZoneParser

func (*DateZoneParser) ParseTimestamp

func (d *DateZoneParser) ParseTimestamp(log string) (time.Time, string, bool)

type Dateformat added in v0.1.2

type Dateformat struct {
	DateRegex  string
	Layout     string
	DateSuffix string
}

type DefaultParser added in v0.1.2

type DefaultParser struct {
	TimestampRegex string
}

func (*DefaultParser) ParseTimestamp added in v0.1.2

func (p *DefaultParser) ParseTimestamp(log string) (time.Time, string, bool)

type EtcdJSONLog

type EtcdJSONLog struct {
	LogLevel  string `json:"level,omitempty"`
	Timestamp string `json:"ts,omitempty"`
	Message   string `json:"msg,omitempty"`
}

type LogMessage

type LogMessage struct {
	Timestamp time.Time `json:"timestamp,omitempty"`
	Time      time.Time `json:"time,omitempty"`
	Log       string    `json:"log,omitempty"`
	Agent     string    `json:"agent,omitempty"`
	LogType   LogType   `json:"log_type"`
	Component string    `json:"kubernetes_component,omitempty"`
	ClusterID string    `json:"cluster_id,omitempty"`
	NodeName  string    `json:"node_name,omitempty"`
}

type LogType added in v0.1.2

type LogType string
const (
	LogTypeControlplane LogType = "controlplane"
	LogTypeRancher      LogType = "rancher"
)

type MultipleParser added in v0.1.2

type MultipleParser struct {
	Dateformats      []Dateformat
	StripLeadingDate bool
}

func (*MultipleParser) ParseTimestamp added in v0.1.2

func (p *MultipleParser) ParseTimestamp(log string) (time.Time, string, bool)

type OpensearchConfig added in v0.1.2

type OpensearchConfig struct {
	ClusterID string
	NodeName  string
	Paths     []string
	Component string
}

type OpensearchInput added in v0.1.2

type OpensearchInput struct {
	*opensearch.Client
	// contains filtered or unexported fields
}

func NewOpensearchInput added in v0.1.2

func NewOpensearchInput(
	ctx context.Context,
	opensearchURL string,
	username string,
	password string,
	config OpensearchConfig,
) (*OpensearchInput, error)

func (*OpensearchInput) ComponentName added in v0.1.2

func (i *OpensearchInput) ComponentName() string

func (*OpensearchInput) Publish added in v0.1.2

func (i *OpensearchInput) Publish(parser DateParser, logType LogType) (time.Time, time.Time, error)

type RKE2EtcdParser

type RKE2EtcdParser struct{}

func (RKE2EtcdParser) ParseTimestamp

func (r RKE2EtcdParser) ParseTimestamp(log string) (time.Time, string, bool)

Jump to

Keyboard shortcuts

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